Closed Vido closed 10 years ago
Thanks for the comment. If I understand what you are saying is that you first successfully start PyMata and then while it is running you try to open another session to the same serial port. Is that correct? If it is, I am unable to reproduce what you are seeing. If you can provide a description of exactly how you generated the error, I would happy to take a look. BTW, I am running PyMata 1.58, but I don't think that will change anything.
Here is my test scenario:
When I open an application that uses PyMata (I used the blink_pymata.py application but bumped the iterations up to 100) and after it is up and running, open another instance of this application (in a second command window), here is what I see:
I do not see mention of thread 4 in my scenario.
@MrYsLab, yes you got it right.The behavior you described is the same here. But the way I can reproduce this does not uses blink_pymata.py.
You can reproduce by running:
on Shell:
$ virtualenv .env_pymata
$ source .env_pymata/bin/activate
(.env_pymata)$ pip install PyMata
# Downloading PyMata-1.58.tar.gz....
on Python:
# change "/dev/ttyUSB0" if necessary
>>> from PyMata.pymata import PyMata
>>> firmata = PyMata("/dev/ttyUSB0")
>>> firmata2 = PyMata("/dev/ttyUSB0")
I didn't realize that you were running from the python interpreter and not a command line. This really is not a valid way of running, since normally a script would be run from the command line, and trying to attach to the same port twice is also an invalid test. I think the order of the exceptions being reported may not be accurate because of a possible race condition of when each of the command handler threads receives the exception condition, the timeout of each read timer and the time to process the exceptions.
I did test using 2 arduino boards at the same time. I opened two separate python interpreters and started PyMata for the serial ports associated with each board and there were no exceptions.
Please let me know if you think what you found was bug so we can discuss it further.
Thanks, Alan
I know it might make no sense for a real code. But should the second call (Thread-4) cause a exception on the first thread (Thread-2)?