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
385 stars 303 forks source link

sms handler demo #89

Closed silgon closed 6 years ago

silgon commented 6 years ago

Hello. I tested the sms_handler_demo.py from your examples directory. In one of my computers it works perfectly fine, but in another, I have the following problem:

Initializing modem...
INFO: Connecting to modem on port /dev/ttyUSB2 at 115200bps
Traceback (most recent call last):
  File "sms_handler_demo.py", line 40, in <module>
    main()
  File "sms_handler_demo.py", line 32, in main
    modem.connect(PIN)
  File "/home/faun/anaconda/2/envs/smsserver/lib/python2.7/site-packages/gsmmodem/modem.py", line 174, in connect
    super(GsmModem, self).connect()
  File "/home/faun/anaconda/2/envs/smsserver/lib/python2.7/site-packages/gsmmodem/serial_comms.py", line 47, in connect
    self.serial = serial.Serial(port=self.port, baudrate=self.baudrate, timeout=self.timeout)
  File "/home/faun/anaconda/2/envs/smsserver/lib/python2.7/site-packages/serial/serialutil.py", line 240, in __init__
    self.open()
  File "/home/faun/anaconda/2/envs/smsserver/lib/python2.7/site-packages/serial/serialposix.py", line 286, in open
    self._update_dtr_state()
  File "/home/faun/anaconda/2/envs/smsserver/lib/python2.7/site-packages/serial/serialposix.py", line 634, in _update_dtr_state
    fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
IOError: [Errno 32] Broken pipe

Have you guys encountered that problem before? I have no idea what it is. I can access the modem with picocom -b 115200 -f n -p n -d 8 -r /dev/ttyUSB2 with no problem.

silgon commented 6 years ago

I found my answer here. My pip installed pyserial==3.4, I downgraded it to pyserial==2.6 and it is now working fine.