clade / PyTektronixScope

23 stars 12 forks source link

No vpp43 on Ubuntu 15.10 #1

Open K0ertis opened 8 years ago

K0ertis commented 8 years ago

Hi! I have a Tektronix TDS1002B and wanted to use your PyTektroinxScope. Unfortunately it does not work. I installed the dependencies ''pyvisa'' (import visa and pyvisa works) and installed the script via: sudo python setup.py install

by starting python and importing PyTektronixScope I get following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/PyTektronixScope/__init__.py", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/PyTektronixScope/PyTektronixScope.py", line 2, in <module>
ImportError: cannot import name vpp43

Thanks for any help!

clade commented 8 years ago

I have not tested the package on linux.

Apparently you can remove the "import vpp43" from the PyTektronixScope file.

The vpp3 is used by the VisaList.py file, which is a helper to get the ID string of your device. If you have a way to find this id string, then it is OK.

Le 12/03/2016 13:49, K0ertis a écrit :

Hi! I have a Tektronix TDS1002B and wanted to use your PyTektroinxScope. Unfortunately it does not work. I installed the dependencies ''pyvisa'' (import visa and pyvisa works) and installed the script via: |sudo python setup.py install|

by starting python and importing PyTektronixScope I get following error:

|Traceback (most recent call last): File "", line 1, in File "build/bdist.linux-x86_64/egg/PyTektronixScope/init.py", line 1, in File "build/bdist.linux-x86_64/egg/PyTektronixScope/PyTektronixScope.py", line 2, in ImportError: cannot import name vpp43 |

Thanks for any help!

— Reply to this email directly or view it on GitHub https://github.com/clade/PyTektronixScope/issues/1.

K0ertis commented 8 years ago

Alright,

Here I found a method, but I am not able to adapt your code

https://askubuntu.com/questions/257636/how-to-connect-tektronix-tds10001b-to-ubuntu

and I tried the following

    def __init__(self):

#        if isinstance(name,  visa.Instrument):
#            resource_name = name.resource_name
#            visa.Instrument.__init__(self, resource_name)
#        else:  
#            visa.Instrument.__init__(self, name)

      self.usbtmc = open("/dev/usbtmc2", "r+")

    def write(self, string):
      self.usbtmc.write(string + "\n")

    def ask(self, size):
      return self.usbtmc.readline().strip()

    def readbin(self, size):
      return self.usbtmc.readline()

Have you any suggestion? I get a timeout error when I write or read anything.

clade commented 8 years ago

You can use this usbtmc class.

class usbtmc(object): """Simple implementation of a USBTMC device driver, in the style of visa.h"""

def __init__(self, device="/dev/usbtmc0"):
    self.device = device
    self.FILE = os.open(device, os.O_RDWR)

def write(self, command):
    os.write(self.FILE, command);

def read(self, length=None):
    if length is None:
        length = 4000
    return os.read(self.FILE, length)

def ask(self, command, length=None):
    self.write(command)
    return self.read(length=length)

Then make TektronixScope heritate from Usbtmc insetead of Visa.

class TektronixScope(Usbtmc):

# There is no __init__