Python Forum
Anaconda3 64bit - problem using a DATAQ Instruments D1110 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Anaconda3 64bit - problem using a DATAQ Instruments D1110 (/thread-18580.html)



Anaconda3 64bit - problem using a DATAQ Instruments D1110 - dgardner54956 - May-23-2019

Hi:

Fairly new to data science oriented Python environment making, and struggling for more than month to put together a collection of audio analysis tools on a Windows 64-bit machine. Let me tell you, I had a heck of time getting pyaudio and portaudio to work. I ended up using Anaconda3 to get to this stage. The microphone in and speaker out works. Most of the example codes out there that start with import pyaudio are working great.

Now, the trouble is that adding my Dataq 8-channel input module to the project, operating in serial mode, can't seem to connect with Dataq Python example code.

(using Dataq's example code):
https://github.com/dataq-instruments/Python/tree/master/binary_comm/DI-1110


(I understand..."The DI-1110 used with this program MUST be placed in its CDC communication mode"...):
https://www.dataq.com/blog/data-acquisition/usb-daq-products-support-libusb-cdc/
(this works, I can see the device on COM3 in the device manager)

There imports are successful in Spyder from the example code Dataq provide in the link above.
import serial
import serial.tools.list_ports
import keyboard
import time

But, I get the following console error:

runfile('C:/Users/Owner/.spyder-py3/MY_DATAQ_D1110.py', wdir='C:/Users/Owner/.spyder-py3')
Traceback (most recent call last):

File "<ipython-input-15-d3312e691d28>", line 1, in <module>
runfile('C:/Users/Owner/.spyder-py3/MY_DATAQ_D1110.py', wdir='C:/Users/Owner/.spyder-py3')

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
execfile(filename, namespace)

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Owner/.spyder-py3/MY_DATAQ_D1110.py", line 53, in <module>
ser=serial.Serial()

AttributeError: module 'serial' has no attribute 'Serial'

I'm stumped.
Does anyone have success stories with Python for Windows64bit and DATAQ analog input modules? Or any other brand of 0-10V analog voltage input modules?
-Dan


RE: Anaconda3 64bit - problem using a DATAQ Instruments D1110 - buran - May-23-2019

Do you have file named serial.py (created by you) in your working directory?


RE: Anaconda3 64bit - problem using a DATAQ Instruments D1110 - dgardner54956 - May-23-2019

I do not have serial.py file

"pip list" reports:
serial 0.0.97
pyserial 3.4


RE: Anaconda3 64bit - problem using a DATAQ Instruments D1110 - buran - May-23-2019

I think there is conflict imports between serial package, which is used for "serializing/deserializing JSON/YAML/XML into python class instances and vice versa" and pyserial
the one used in your case is pyserial. for simplest solution remove serial package unless you really need it


RE: Anaconda3 64bit - problem using a DATAQ Instruments D1110 - dgardner54956 - May-23-2019

completed these:
pip uninstall serial
pip install --upgrade --force-reinstall pyserial

to make sure the port is readable, I also did this:
opened up COM3,9600,8,1,N in putty and was able to issue commands and see responses from the D110.

found another useful command along the way..:
python -m serial.tools.list_ports

Spyder still failing, so moved the whole example code into a Anaconda3 Jupyter notebook:
and added some more code after the import lines:

print("PORT LIST")
ports = list(port_list.comports())
for p in ports: print (p)
print("END PORT LIST")

got this output! PROBLEM SOLVED:

PORT LIST
COM3 - DATAQ DI-1110 (COM3)
END PORT LIST
Found a DATAQ Instruments device on COM3
stop
encode 0
ps 0
slist 0 0
slist 1 1
slist 2 1801
slist 3 8
slist 4 10
srate 60000

Ready to acquire...

Press <g> to go, <s> to stop, <r> to reset counter, and <q> to quit:[/color]

Remaining question:
Why does this not work in the Spyder environment.

Thanks for the help so far...
-Dan :)


RE: Anaconda3 64bit - problem using a DATAQ Instruments D1110 - buran - May-23-2019

Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.

I am not familiar with Spyder and its environment, maybe someone else could help more