What i am trying to do

Performs processing according to the received message.
The processing to be performed calls the following two programs in the subprocess.
① "rrr"
Program to turn on/off the LED
② "xxxx"
A program that repeats LED blinking and buzzer ON until the switch is pressed

Received message'xxxx' on topic'system' with QoS 1
Received xxxx ...
No handlers could be found for logger "AWSIoTPythonSDK.core.protocol.mqtt_core"
Traceback (most recent call last):
  File "./test.py", line 90, in<module>
    client.subscribe (TOPIC, 1, my callback)
  File "/usr/local/lib/python2.7/dist-packages/AWSIoTPythonSDK/MQTTLib.py", line 696, in subscribe
    return self._mqtt_core.subscribe (topic, QoS, callback)
  File "/usr/local/lib/python2.7/dist-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py", line 306, in subscribe
    raise subscribeTimeoutException ()
  • Answer # 1

    It was avoided by setting the timeout of AWSIoTPythonSDK.MQTTLib.

  • Answer # 2

    When started with subprocess.check_call, the process does not move to the next line until the command is completed. Therefore, since xxxx never ends, it seems that the Subscribe side remains stopped and an exception of subscribeTimeoutException has occurred.

    You need to use subprocess.Popen to get the desired movement.

    Reference: https://jellyware.jp/kurage/raspi/subprocess.html

  • Answer # 3

    Since subprocess.check_call is used in mycallback, it seems that the process has not returned and has timed out.