LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabPython not working. Error 1046

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.

0 Kudos
Message 1 of 8
(4,788 Views)

-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.

Thanks
uday
Message 2 of 8
(4,776 Views)

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.

Message 3 of 8
(4,761 Views)

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

0 Kudos
Message 4 of 8
(4,724 Views)

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?

0 Kudos
Message 5 of 8
(4,662 Views)

It will be good to debug if you post atleast what error you are getting.

Thanks
uday
0 Kudos
Message 6 of 8
(4,655 Views)

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.

0 Kudos
Message 7 of 8
(4,650 Views)

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.

 

0 Kudos
Message 8 of 8
(4,624 Views)