Question

I'm migrating PyVisa from Python 2.6 to Python 3.2. I'm able to install the module. It's listed in C:\Python32\Lib\site-packages\pyvisa

The __init__.py file imports a module (vpp43.py) from this folder. At this line I get following error:

Traceback (most recent call last):
File "D:\Documents and Settings\grknbl16\My Documents\PatternControl.py", line 2, in <module>
from taborAwg import configTabor
File "D:\Documents and Settings\grknbl16\My Documents\taborAwg.py", line 1, in <module>
from visa import Instrument, vpp43
File "C:\Python32\lib\site-packages\visa.py", line 1, in <module>
from pyvisa.visa import *
File "C:\Python32\lib\site-packages\pyvisa\__init__.py", line 34, in <module>
import configparser, os, sys, vpp43
ImportError: No module named vpp43

Where is the mistake?

Was it helpful?

Solution

In Python 3.x implicit relative imports have gone away. Instead of

import configparser, os, sys, vpp43

pyvisa\__init__.py needs to say:

import configparser, os, sys
from . import vpp43
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top