Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when execute modem_cliente in a loop #27

Open
waze96 opened this issue Nov 13, 2020 · 1 comment
Open

Exception when execute modem_cliente in a loop #27

waze96 opened this issue Nov 13, 2020 · 1 comment
Labels
question Further information is requested

Comments

@waze96
Copy link

waze96 commented Nov 13, 2020

When the code execute the second call this exception appears:

INFO:root:Started /dev/ttyUSB0 #SECONDNUMBER 1 1 1
INFO:iec870ree.modem:try open port 0
INFO:iec870ree.modem:serial port /dev/ttyUSB0 opened
INFO:iec870ree.modem:read thread Starting
INFO:iec870ree.modem:sending command ATZ
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/dist-packages/iec870ree-0.6.0-py3.8.egg/iec870ree/modem.py", line 144, in read_port
File "/usr/local/lib/python3.8/dist-packages/pyserial-3.4-py3.8.egg/serial/serialposix.py", line 494, in read
buf = os.read(self.fd, size - len(read))
TypeError: an integer is required (got type NoneType)
INFO:iec870ree.modem:R-ATZ

INFO:iec870ree.modem:R-OK

INFO:iec870ree.modem:sending command AT+CBST=7,0,1
INFO:iec870ree.modem:R-AT+CBST=7,0,1

INFO:iec870ree.modem:R-OK

The error comes from the 494 line of serialposix.py, here: buf = os.read(self.fd, size - len(read))
Problem is that self.fd is None after the first number, any idea of how fix this?

@ecarreras
Copy link
Member

It seems like is a problem in the connection with the modem, can you try upgrading pyserial package? or you can use the modem directly with the terminal?

@ecarreras ecarreras added the question Further information is requested label Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants