LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with LabVIEW integration with Python

I am trying to get this code for a Programmable Power Supply to work with LabVIEW by using the Python codes. I am getting this error currently, I think it is because I am skipping some modules, I am not sure if there is some kind of initiation process for Python when there is an outside device being interfaced as well. The CMD is the main code, and my power supply is PPS2116A. 

 

Python Node in python_node.vi<APPEND>

Module Path: C:\Users\zimmermanho\AppData\Local\Programs\Python\Python36\LabVIEW\PowerSupply_ElectronicLoad_Control-master\cmd.py
Function Name: normalRun
Python returned the following error: <class 'ModuleNotFoundError'>
No module named 'visa'
<traceback object at 0x000002B3B25E0448>


Call Stack information:
['Traceback (most recent call last):
', ' File "C:\Users\zimmermanho\AppData\Local\Programs\Python\Python36\LabVIEW\PowerSupply_ElectronicLoad_Control-master\cmd.py", line 17, in <module>
import ElectronicLoads as electronicload
', ' File "C:\Users\zimmermanho\AppData\Local\Programs\Python\Python36\LabVIEW\PowerSupply_ElectronicLoad_Control-master\ElectronicLoads\__init__.py", line 6, in <module>
import visa
', "ModuleNotFoundError: No module named 'visa'
"]

 

 

Since the error says something about VISA I was thinking it had to do with the USB.

0 Kudos
Message 1 of 5
(2,879 Views)

I fixed this error, it was because I did not install the right requirements. Now having the correct requirements, I am getting a new error message. When I try to call a function, I get this error:

 

Python Node in python_node.vi<APPEND>

Module Path: C:\Users\zimmermanho\AppData\Local\Programs\Python\Python36\LabVIEW\PowerSupply_ElectronicLoad_Control-master\PowerSupplies\pps2116a.py
Function Name: setVoltage
Python returned the following error: Function could not be found in the module

 

I don't know if this is because I am mission some kind of initialization state, or maybe I don't have the correct return types. I am not sure

0 Kudos
Message 2 of 5
(2,865 Views)

As you already found, your first problem was with installation. Your second may also be an installation problem, but that's less clear without the code.

 

Essentially it's saying that in the file listed (pps2116a.py) there is not a function named setVoltage. 

 

Possible causes might include:

  • Corrupt file due to installation, etc
  • Bad caller (typo, maybe it should be set_voltage or something)
  • Missing other import (perhaps some other file should have been imported, perhaps by the pps2116a file, that provides this function)
  • Unsupported use of includes for all functions. Maybe the LabVIEW caller doesn't have exactly the same behaviour with indiscriminate importing as the Python interpreter defaults. Does it work if you use the command line?

GCentral
0 Kudos
Message 3 of 5
(2,838 Views)

I had this same problem and I solved it by includeing the FULL PATH of the python module. You can see a video here.

Cheers!

Message 4 of 5
(2,143 Views)
 

what did you do to fix this error? 

 

0 Kudos
Message 5 of 5
(1,415 Views)