Closed nktsaini closed 9 years ago
Can you put a breakpoint to findout the host and port. And then do:
>>> print((host, socket))
>>> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> sock.connect((host, post))
( By the way. Not related but I will strongly suggest to upgrade your Python to the latest 2.7 . There are important bugfixes there.
I added a few log call. Enable logging to check it out.
I am new with python so I'm looking up how to put a breakpoint. I'll reply as soon as possible.
I am using the python debugger (pdb) which automatically sets breakpoint after each line. But after the line:
dmm = rm.open_resource('TCPIP::10.66.53.50::inst0::INSTR')
when I ask it to print the host and socket, it says the name 'host' is not defined.
Can you update to the latest pyvisa-py (in github) and then run your script prepending:
import visa
visa.log_to_screen()
I updated the pyvisa-py on my system and added the line. This is what I get now:
debian@beaglebone:~/Documents/Keithley PyVISA$ python comms.py
2015-05-26 00:00:23,467 - pyvisa - DEBUG - SerialSession was not imported No module named tools.list_ports.
2015-05-26 00:00:23,472 - pyvisa - DEBUG - USBSession was not imported No module named usb.
2015-05-26 00:00:23,476 - pyvisa - WARNING - (<InterfaceType.usb: 7>, u'INSTR') is already registered in the ResourceManager. Overwriting with unavailable Please install PyUSB to use this resource type.
No module named usb
2015-05-26 00:00:23,478 - pyvisa - WARNING - (<InterfaceType.usb: 7>, u'RAW') is already registered in the ResourceManager. Overwriting with unavailable Please install PyUSB to use this resource type.
No module named usb
2015-05-26 00:00:23,484 - pyvisa - DEBUG - USBRawSession was not imported No module named usb.
2015-05-26 00:00:23,569 - pyvisa - DEBUG - TCPIPSession was correctly imported.
2015-05-26 00:00:23,576 - pyvisa - DEBUG - GPIBSession was not imported No module named gpib.
2015-05-26 00:00:23,586 - pyvisa - DEBUG - Created library wrapper for unset
2015-05-26 00:00:23,593 - pyvisa - DEBUG - Created ResourceManager with session 7914990
2015-05-26 00:00:23,596 - pyvisa - DEBUG - TCPIP::10.66.53.50::inst0:INSTR - opening ...
2015-05-26 00:00:23,603 - pyvisa - DEBUG - RawTCPClient: connecting to socket at (10.66.53.50, 111)
Traceback (most recent call last):
File "comms.py", line 7, in <module>
dmm = rm.open_resource('TCPIP::10.66.53.50::inst0:INSTR')
File "/usr/local/lib/python2.7/dist-packages/PyVISA-1.8.dev0-py2.7.egg/pyvisa/highlevel.py", line 1634, in open_resource
res.open(access_mode, open_timeout)
File "/usr/local/lib/python2.7/dist-packages/PyVISA-1.8.dev0-py2.7.egg/pyvisa/resources/resource.py", line 184, in open
self.session, status = self._resource_manager.open_bare_resource(self._resource_name, access_mode, open_timeout)
File "/usr/local/lib/python2.7/dist-packages/PyVISA-1.8.dev0-py2.7.egg/pyvisa/highlevel.py", line 1598, in open_bare_resource
return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/highlevel.py", line 198, in open
sess = cls(session, resource_name, parsed)
File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/sessions.py", line 184, in __init__
self.after_parsing()
File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/tcpip.py", line 45, in after_parsing
self.interface = vxi11.CoreClient(self.parsed.host_address)
File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/vxi11.py", line 197, in __init__
super(CoreClient, self).__init__(host, DEVICE_CORE_PROG, DEVICE_CORE_VERS)
File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/rpc.py", line 595, in __init__
pmap = TCPPortMapperClient(host)
File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/rpc.py", line 573, in __init__
RawTCPClient.__init__(self, host, PMAP_PROG, PMAP_VERS, PMAP_PORT)
File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/rpc.py", line 334, in __init__
self.connect()
File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/rpc.py", line 339, in connect
self.sock.connect((self.host, self.port))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 110] Connection timed out
2015-05-26 00:02:31,317 - pyvisa - DEBUG - TCPIP::10.66.53.50::inst0:INSTR - closing
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,467 - pyvisa - DEBUG - SerialSession was not imported No module named tools.list_ports.
bash: 2015-05-26: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,472 - pyvisa - DEBUG - USBSession was not imported No module named usb.
bash: 2015-05-26: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,476 - pyvisa - WARNING - (<InterfaceType.usb: 7>, u'INSTR') is already registered in the ResourceManager. Overwriting with unavailable Please install PyUSB to use this resource type.
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ No module named usb
bash: No: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,478 - pyvisa - WARNING - (<InterfaceType.usb: 7>, u'RAW') is already registered in the ResourceManager. Overwriting with unavailable Please install PyUSB to use this resource type.
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ No module named usb
bash: No: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,484 - pyvisa - DEBUG - USBRawSession was not imported No module named usb.
bash: 2015-05-26: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,569 - pyvisa - DEBUG - TCPIPSession was correctly imported.
bash: 2015-05-26: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,576 - pyvisa - DEBUG - GPIBSession was not imported No module named gpib.
bash: 2015-05-26: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,586 - pyvisa - DEBUG - Created library wrapper for unset
bash: 2015-05-26: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,593 - pyvisa - DEBUG - Created ResourceManager with session 7914990
bash: 2015-05-26: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,596 - pyvisa - DEBUG - TCPIP::10.66.53.50::inst0:INSTR - opening ...
bash: 2015-05-26: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:00:23,603 - pyvisa - DEBUG - RawTCPClient: connecting to socket at (10.66.53.50, 111)
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ Traceback (most recent call last):
bash: syntax error near unexpected token `most'
debian@beaglebone:~/Documents/Keithley PyVISA$ File "comms.py", line 7, in <module>
bash: syntax error near unexpected token `newline'
debian@beaglebone:~/Documents/Keithley PyVISA$ dmm = rm.open_resource('TCPIP::10.66.53.50::inst0:INSTR')
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/local/lib/python2.7/dist-packages/PyVISA-1.8.dev0-py2.7.egg/pyvisa/highlevel.py", line 1634, in open_resource
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ res.open(access_mode, open_timeout)
bash: syntax error near unexpected token `access_mode,'
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/local/lib/python2.7/dist-packages/PyVISA-1.8.dev0-py2.7.egg/pyvisa/resources/resource.py", line 184, in open
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ self.session, status = self._resource_manager.open_bare_resource(self._resource_name, access_mode, open_timeout)
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/local/lib/python2.7/dist-packages/PyVISA-1.8.dev0-py2.7.egg/pyvisa/highlevel.py", line 1598, in open_bare_resource
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/highlevel.py", line 198, in open
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ sess = cls(session, resource_name, parsed)
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/sessions.py", line 184, in __init__
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ self.after_parsing()
> File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/tcpip.py", line 45, in after_parsing
bash: syntax error near unexpected token `File'
debian@beaglebone:~/Documents/Keithley PyVISA$ self.interface = vxi11.CoreClient(self.parsed.host_address)
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/vxi11.py", line 197, in __init__
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ super(CoreClient, self).__init__(host, DEVICE_CORE_PROG, DEVICE_CORE_VERS)
bash: syntax error near unexpected token `CoreClient,'
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/rpc.py", line 595, in __init__
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ pmap = TCPPortMapperClient(host)
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/rpc.py", line 573, in __init__
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ RawTCPClient.__init__(self, host, PMAP_PROG, PMAP_VERS, PMAP_PORT)
bash: syntax error near unexpected token `self,'
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/rpc.py", line 334, in __init__
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ self.connect()
> File "/usr/local/lib/python2.7/dist-packages/PyVISA_py-0.2.dev2-py2.7.egg/pyvisa-py/protocols/rpc.py", line 339, in connect
bash: syntax error near unexpected token `File'
debian@beaglebone:~/Documents/Keithley PyVISA$ self.sock.connect((self.host, self.port))
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ File "/usr/lib/python2.7/socket.py", line 224, in meth
bash: File: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ return getattr(self._sock,name)(*args)
bash: syntax error near unexpected token `('
debian@beaglebone:~/Documents/Keithley PyVISA$ socket.error: [Errno 110] Connection timed out
bash: socket.error:: command not found
debian@beaglebone:~/Documents/Keithley PyVISA$ 2015-05-26 00:02:31,317 - pyvisa - DEBUG - TCPIP::10.66.53.50::inst0:INSTR - closing
bash: 2015-05-26: command not found
What can I do now?
Also, could you please tell me on what OS do you develop the pyvisa and the pyvisa-py?
Is this still a problem? I develop on Mac I have people using it on Windows and Mac. Feel free to reopen.
I am trying to use PyVISA-py as a backend to PyVISA on a device which runs Debian 7.8 wheezy. I have installed the latest versions of both PyVISA and PyVISA-py available as of the time of this post.
When I run
I get:
Then I go ahead and try communication with the Keithley using these commands:
I get:
Any help is highly appreciated.
PS. I can ping the IP address 10.66.53.50 with zero packets lost.