Adding PyVisa wrapped libraries to personal Ignition library

I inserted the pyvisa library folder into the C:\Program Files\Inductive Automation\Ignition\user-lib\pylib directory. And getting the following error in logs during compilation:

12:30:21.868 [AWT-EventQueue-0] INFO device_control -- Check device button clicked.
12:30:23.635 [AWT-EventQueue-0] ERROR device_control -- Error checking device: Error loading module device_control: Traceback (most recent call last):
  File "<module:device_control>", line 5, in <module>
SyntaxError: ("mismatched input '-' expecting COLON", ('C:\\Users\\E40012709\\.ignition\\cache\\gwlocalhost_8088\\C0\\pylib\\pyvisa\\__init__.py', 32, 39, 'def log_to_screen(level=logging.DEBUG) -> None:\n'))

This is not Python 2.7 syntax; you'll have to find an older version of that library that is compatible with Python 2.7, if there is one.

2 Likes

Even if you find a Python 2.7 syntax version, it likely has native code dependencies that mean it won't work in Ignition's Jython environment.

Some other folks with the same problem as you lead to this discussion thread where someone has code that may solve your problem:

1 Like