Jump to content

LabPython Newbie Help!


Recommended Posts

Hi all,

Title says it all. I'm a newbie to Python (and thus to Labpython) although not to LabVIEW. I've got a friend who is a Python genius but a newbie to LabVIEW. He's written me an algorithm in Python that i want to run in Labpython before trying to check it out before implementing it in LabVIEW (or i may just leave it in Python). Problem is we keep on getting errors and between us have no idea what is wrong. I cannot find any documentation on Labpython or examples (except for one here).

What i need is a bit of Python code (some advanced stuff would be great) that runs succesfully in Labpython so that my friend can take a look and see the format/style/method of writing python code for Labpython).

Could someone point me in the right direction either with a bit of code or some sort of documentation to help?

Thanks

Phil

Link to comment

Hi Phil,

Here's a simple example (in LabVIEW 8.5):

post-17-1204827729.png?width=400

Download File:post-17-1204827742.vi

Which versions of LabPython, LabVIEW, and Python are you using?

Thanks,

-Jim

PS - The link here doesn't have anything to do with LabPython -- that example uses TCP-IP to communicate with Python, whereas LabPython uses a DLL to communicate with Python.

Link to comment
  • 7 years later...

Hi guys. First of all - sorry for the thread necromancy, but I prefer that to making a new similar one.

 

So... I've installed a fresh Installation of LabView 2015, OpenG Toolkit 4.0.x and LabPython 4.0.0.4. Apart from that I have Python 3.5 installed (Anaconda3). How to get these things to work together?

 

I've tried to make a simplest possible VI with only three LabPython pieces - first of all I show him where the python35.dll is, the I open a new session and close it after that. What I get in return? some errors. First of all i get LabView error 1046 in "PYTHON New Session__ogtk.vi->Untitled 1" and then a Debugging Windows informs me that it "Couldn't load symbol _Py_ZeroStruct". 

 

So what is my mistake? can you help me?

Link to comment

I haven't worked with LabPython. From the release information here it indicates that LabPython was tested with Python v2.5. Don't know if that makes a difference.

 

I haven't used LabPython before either, but I do know that Python 2.x is not compatible with Python 3.x.

 

 

Debugging Windows informs me that it "Couldn't load symbol _Py_ZeroStruct". 

 

I'm guessing that the function called "_Py_ZeroStruct()" exists in the Python 2.x DLL, but not the Python 3.x DLL.

 

Try installing Python 2 instead.

Edited by JKSH
Link to comment

Python 2.7 works with LabPython on LabVIEW up to (at least) 2014, 32bit only, BUT there is something about the anaconda builds that causes LabVIEW to crash on recent 2.7 releases. Running plain vanilla python as downloaded from python.org works fine. One gets the feeling that LabPython in its current form is not goign to be viable for very much longer as both languages continue to develop (Python 3.x and 64 bit code are not supported for example, the scripting node interfaces are not well supported with public documentation) - probably a better solution would be to build an interface between LabVIEW and a Juypter (ipython) kerenel process - but I know I don't have time to work on anything this complicated :-(

Any python module that is not thread safe will also cause problems - unfortunately that includes numpy - but sometimes one can avoid tripping over the non thread-safe bits if one is cautious in which bits of numpy one tries to call).

Edited by gb119
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.