abc4329803 Posted December 18, 2013 Report Posted December 18, 2013 (edited) I want to use the Python extension libs such as ROOT (http://root.cern.ch/drupal/content/how-use-use-python-pyroot-interpreter and http://root.cern.ch/drupal/content/production-version-528), 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 set PATH=%ROOTSYS%/bin;%PATH%set PYTHONPATH=%ROOTSYS%/bin;%PYTHONPATH% 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 Thanks! demo.vi demo_python.vi Edited December 18, 2013 by abc4329803 Quote
Rolf Kalbermatter Posted January 6, 2014 Report Posted January 6, 2014 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. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.