Jump to content

LabPython and third party extension (ROOT of CERN) Compatible

Recommended Posts

I want to use the Python extension libs such as ROOT
but it is strange for
me to use the labpython. I write a demo.py to import ROOT(just like this "from ROOT import gROOT, TCanvas, TF1") which is running in
LabPython, but it seems to crash for LabVIEW, but it can be used outside of LabVIEW if python it in the command line. And If I run the python
script without ROOT lib, it is normal in LabPython. How can I solve it?
My python version is 2.6, the ROOT version 5.28, and LabVIEW version is 2011. LabPython version is 4.004.
The Python file could not be uploaded, so I change the name from demo.py to demo_python.vi. Please change it after download.
And LabVIEW file is also uploaded.
My ROOT env config variables are 
So after setting config variables, you can type the command "python -i demo.py" in the python installation directory in the command line.
It is normal running, but you could not do it in LabPython using the same code.
And My LabVIEW.ini is setting like this: PythonServer=C:WINDOWSsystem32python26.dll



Edited by abc4329803
Link to comment
  • 3 weeks later...

The sources for all OpenG libraries are on sourceforge. There is a project for the "OpenG Toolkit" and a separate project for "LabPython", since LabPython predates the OpenG Toolkit by a few months. The first search result in Google points to the LabPython home page hosted on sourceforge and has links to the the sourceforge project page where you can go to the code section and see that it contains both the LabVIEW and C code. It's still in CVS but there is an option to download the entire repository as GNU tarball, so no need to install a CVS client if you don't want to.


As to the reason why it may crash, when you add ROOT to your python project, there are many possibilities. LabPython was developed with Python 2.3. It seems to work fairly well for most people with Python versions < 3.0, but there seem to be problems with certain Python libraries that contain binary components (C(++) DLLs compiled as Python modules). The reason is probably some version conflicts in runtime libraries between LabVIEW, the LabPython DLL and those binary Python modules.


Hacking your own ROOT script interface based on LabPython might be a possibility but unless you are really deep into C programming I wouldn't recommend it.

  • Like 1
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.

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.