faucamp / python-gsmmodem

Python module to control a GSM modem attached to the system: send/receive SMS messages, handle calls, etc
GNU Lesser General Public License v3.0
384 stars 302 forks source link

getting attribute error. #33

Open Thundersoul opened 10 years ago

Thundersoul commented 10 years ago

Getting error . AttributeError: 'GsmModem' object has no attribute 'rxThread'.Can anyone explain this error?

faucamp commented 10 years ago

The rxThread object attribute is created in the connect() method of a SerialComms object (which a GsmModem object inherits).

Did you call modem.connect() as the first operation in your script? (where "modem" is your GsmModem object) If not, the rxThread attribute would not have been created, and you would get this error when calling other methods such as sendSms, etc.

Thundersoul commented 10 years ago

Yes, I call the modem.connect() as the first operation . I connected more than one modems and check them in loop whether the modem is alive or not after 10 second.but sometimes firstly it gives serial exception and after then it gives this error.

faucamp commented 10 years ago

Could you please post the stacktrace of that serial exception? It sounds like pyserial failed to connect to the underlying modem (first operation inside the connect() method) - this would cause the rxThread variable to not be created, which is why you are getting the attribute error afterwards.