LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a .py script inside a .VI, using anaconda's Libraries or specific python version (SystemExec.vi(?), MAC OSX)

Hi,

 

 

I'm new to both mac and LabView, so it may well be something obvious I'm missing.

 

I'm trying to use System Exec (http://zone.ni.com/reference/en-XX/help/371361L-01/glang/system_exec/ with LabVIEW 2014 on Mac OS X Mavericks) to call a python script to do some image processing after taking some data and saving images via LabView.

 

My problem is that I cannot figure out how to point it to the correct version/install of python to use, as it seems to use the pre-installed 2.7.5 apple version no matter whether that's set to be my default or not (and hence, it can't see my SciPy, PIL etc. packages that come with my Anaconda install).

It doesn't seem to matter whether I have certain packages installed for 2.7 accessable via the terminal, the LabView System Exec command line can't seem to find them either way and throws up an error if a script is called that imports them.

 

 

I've tried changing the working directory to the relevant anaconda/bin folder, I've also tried

cd /Applications/anaconda/bin; python <file.py> 

as the CL input to system exec, but it's not wanting to use anything other than the apple install. I've tried Anaconda installs with both python 2.7 and 3.4, so it doesn't seem to be down to the 3.* compatibility issues alone.

 

 

Printing the python version to a string indicator box in LV via python script gives the following:

 

2.7.5 (default, Mar 9 2014, 22:15:05)

[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]

 

Whereas via the terminal, the default version is the anaconda install I'd like to use, currently

 

Python 3.4.1 |Anaconda 2.1.0 (x86_64)| (default, Sep 10 2014, 17:24:09)

[GCC 4.2.1 (Apple Inc. build 5577)] on darwin

 

I can do which python3.4 on the sys exec CL input to get the correct /anaconda/bin location, but if I try  python3.4 <file.py>, I just get a Seg fault.

 

 

I've found examples for System Exec use and instructions for calling python scripts with specific versions, but neither works with Mac (frustratingly).

 

I've also tried editing the Path Environment Variable, and tried getting rid of the python 2.7 install entirely, but none of these work either (the latter just causing errors all over the shop).

 


 

 

 

 

So, in summary

I'd just like to know how to specify the python version LabView uses and to have use of the corresponding python libraries.

 

Either python version (2 or 3) will do, I'd just like to be able to use my libraries which came with Anaconda which I'll be writing my scripts with (which I installed as the correct packages are only compatible with a specific python version on Mac, which is not the specific version that Xcode was compatible with, argh).

 

All packages work normally when using the Anaconda version with the terminal or with Spyder.

 

Is there a function I can use other than System Exec? What am I missing?

 

Please help.

0 Kudos
Message 1 of 4
(3,625 Views)

Accidental. Also, that's not terribly helpful.

0 Kudos
Message 3 of 4
(3,576 Views)

@janedoe777 wrote:

Accidental. Also, that's not terribly helpful.


What exactly does that mean?

 

I'm not debating whether it was accidental or intentional.  It certainly isn't helpful to post the same message twice.

 

It is helpful to point out this message is a duplicate so people don't waste their time answering this one if you are already being helped in the other one.

0 Kudos
Message 4 of 4
(3,562 Views)