08-16-2016 09:54 AM
Hi.
I have recently installed LabPython to run some powerful scripts from within Labview. I cannot get it to work and keep getting error 1046. From what I have seen in other discussions there seems to be some dll files required or renamed but is not really clear what. I have Python 2.7 and Labview 2015 installed. Is Labpython compatible with this version and if so what files are required to get it to work?
Thanks,
Mark.
08-16-2016 10:35 AM
-Could you post your vi/snippet? If you don't know how to add snippet : http://www.ni.com/tutorial/9330/en/
-One of the problems mentioned in previous posts was about 32 bit dll and 64 bit dll. Which version of python you have installed?
-Please post screenshot of error also if possible.
08-16-2016 11:22 AM
I actually managed to get it working by adding the set server path vi and setting it to C:\Windows\System32\python27.dll.
I am now able to run basic scripts from Labview. However when I try to run more complex ones which import other scripts I am getting errors. They have been run within python fine so I am wondering is there any limitations from within Labview. can Labview run scripts which have multiple imports?
Mark.
08-17-2016 04:35 AM
Hi Mark,
Hopefully the discussion in the below thread may answer your question:
http://forums.ni.com/t5/LabVIEW/Labpython-unable-to-import-copy-reg/td-p/980486
Regards,
Nathan
08-23-2016 05:57 AM
I seem to be getting more errors, none that are generated in labview or Python. I think there may be an issue with the dll. is it compatible for recent versions of Labview?
08-23-2016 06:12 AM
It will be good to debug if you post atleast what error you are getting.
08-23-2016 07:01 AM
In the attached file the vi is running the Example.py script which uses the other files included. When I run within python it works fine. It connects to a multimeter via bluetooth and output the voltage and current to the console. I would like to do the same except from within Labview instead. When I rin it I get the following error 1050
LabVIEW: Error occurred while executing script. Error message from server: <type 'exceptions.AttributeError'>, 'exceptions.SystemExit' object has no attribute 'text'. in PYTHON Test Script Node.vi
Mark.
08-24-2016 05:06 AM
So i have changed the vi to that in the attached and seems to be a bit more responsive. When I set the script text to the following it runs without error.
import BGWrapper from Mooshimeter import Mooshimeter from operator import attrgetter if __name__=="__main__": # Set up the lower level to talk to a BLED112 in port COM4 # REPLACE THIS WITH THE BLED112 PORT ON YOUR SYSTEM BGWrapper.initialize("COM14") # Scan for 3 seconds scan_results = BGWrapper.scan(3)
However when I add the following line which includes the mooshimeter function:
meters = filter(lambda(p):Mooshimeter.mUUID.METER_SERVICE in p.ad_services, scan_results)
I get error 1050: PYTHON Execute Script__ogtk.vi->PythonTestScript.vi:<type 'exceptions.NameError'>, global name 'Mooshimeter' is not defined.
This is unusual as BGWrapper works fine and is located in the same folder. Any ideas as to why mooshimeter will not work?
Thanks,
Mark.