I am pretty sure you can do that as one command without semicolons or export. I.e,

system("PYTHONPATH=/usr/bin/python PYTHONHOME=/usr/share/python/ /path/to/script args");

The script should see the variables. I tested this on OS X, should work on other systems as well.

Paul

On 12/16/2015 2:29 PM, Rick Mann wrote:
Sorry, I didn't specify enough constraints in my original post.

- The code that calls the external scripts has to be cross-platform, and run on 
linux as well as OS X. So, no NSTask.
- I can modify the code that calls the scripts, and I can use OS X-only APIs to 
set up a global environment (for processes launched by my app) if that sort of 
thing is possible.
- I don't want to make the user modify things like launchd config or /etc. They 
can install required dependencies (like certain Python modules), but that's 
about it. I'd love to find a way to package those in the app bundle, too.

I'm thinking the best thing to do is pass in paths and an environment string to be used 
in the system() call (e.g., invoke it as "export PYTHONPATH=...; export 
PYTHONHOME=...; path/to/script args"). Maybe I can even leverage that to let me put 
the requisite python modules in the app bundle...


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to