MrYsLab / pymata-aio

This is the second generation PyMata client.
https://github.com/MrYsLab/pymata-aio/wiki
GNU Affero General Public License v3.0
155 stars 51 forks source link

Can't Initialize Pymata Object In Anaconda/Spyder #68

Closed bjfurman closed 6 years ago

bjfurman commented 6 years ago

I tried sending an email to mryslab@gmail.com, but it bounced, so I'm including the issue here.

I'm trying to use PyFirmataPlus within Anaconda Spyder, and I'm having trouble getting it to initialize. I think it finds the required libraries, but at run time it seems to have trouble finding my com port. I'm including the error messages received below. I am able to get PyFirmataPlus to work by running the .py file in question from a terminal command line, and I know that Python can find the COM port that I have an Arduino connected to, because a simple program:

import serial import serial.tools.list_ports print(list(serial.tools.list_ports.comports()))

successfully returns:

runfile('C:/Users/000020801/.spyder-py3/serial_test.py', wdir='C:/Users/000020801/.spyder-py3') [('COM12', 'Arduino Uno (COM12)', 'USB VID:PID=2341:0001 SNR=64935343133351806271')]

Here is the error I get trying to execute the code I want Python to interact with the Arduino:

Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information.

IPython 6.4.0 -- An enhanced Interactive Python.

runfile('C:/Users/000020801/.spyder-py3/serial_test.py', wdir='C:/Users/000020801/.spyder-py3')

runfile('C:/Users/000020801/.spyder-py3/testPyFirmata.py', wdir='C:/Users/000020801/.spyder-py3')

pymata_aio Version 2.20 Copyright (c) 2015-2017 Alan Yorinks All rights reserved.

Unable to find Serial Port, Please plug in cable or check cable connections. Traceback (most recent call last):

File "", line 1, in runfile('C:/Users/000020801/.spyder-py3/testPyFirmata.py', wdir='C:/Users/000020801/.spyder-py3')

File "C:\Users\000020801\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)

File "C:\Users\000020801\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/000020801/.spyder-py3/testPyFirmata.py", line 15, in board = PyMata3()

File "C:\Users\000020801\AppData\Local\Continuum\Anaconda3\lib\site-packages\pymata_aio\pymata3.py", line 61, in init com_port, ip_address, ip_port, ip_handshake)

File "C:\Users\000020801\AppData\Local\Continuum\Anaconda3\lib\site-packages\pymata_aio\pymata_core.py", line 211, in init self.com_port = self._discover_port()

File "C:\Users\000020801\AppData\Local\Continuum\Anaconda3\lib\site-packages\pymata_aio\pymata_core.py", line 1781, in _discover_port exit()

NameError: name 'exit' is not defined

On a related note, have you 'conda-ized' (made a conda repository) of your PyFirmataPlus to make installation within Anaconda easier, and/or do you have any interest in doing this? I found a reference to pymata at anaconda.org, but I was not able to install it.

Any clues as to why this is not working is much appreciated!

bjfurman commented 6 years ago

I came across https://github.com/MrYsLab/pymata-aio/issues/67 today, and the regression of tornado to ver. 4.5.3 it describes solved the issue I raised. I'm in business now!