Forum: Poser Python Scripting


Subject: PoserPython prevented from using os.system on OS X?

deastham opened this issue on Jan 20, 2015 · 4 posts


deastham posted Tue, 20 January 2015 at 11:49 AM

I have a script which works on the PC side, but on OS X it seems that commands run with os.system(MyCommand) have no effect. Is there a workaround or solution for this (aside from only using my script on the PC)? Currently I have the script add the command to a string, separated by a '; '.. at the end, I just print thie command string, and copy and paste it into a terminal, where it works. Please advise.

Thanks in advance.


Pret-a-3D posted Tue, 20 January 2015 at 11:59 AM

Hi.

I just tried it with os.system("/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal") and it launched Terminal as expected. 

What is the exact command that you tried?

Paolo

https://www.preta3d.com
FB: https://www.facebook.com/RealityPlugIn
Tw: @preta3d
G+: https://plus.google.com/106625816153304163119
The Reality Gallery: https://reality-plug-in.deviantart.com


deastham posted Tue, 20 January 2015 at 1:04 PM

I am attempting to run tdlmake to convert a texture to TDL format. ("tdlmake inputtexturepath outputtexturepath" (where they were given values such that copying and pasting the whole string worked as a command in Terminal).

When I am in the PoserPython shell in Poser Pro 2012, I can run os.system("echo hello world") and it returns the exit code of 0 to the shell output, but if I attempt to run a command that requires an environment variable, it returns a non-zero error code. Even just os.system("echo $DELIGHT") (which returns the path in a real Terminal session) gives the same error code 32512. For what I am doing now, I can just store a variable in the script with that information, and now that I realize halfway through this reply what's going on, I can hopefully find the solution in a more general Python resource.

Thanks Paolo. :)


deastham posted Tue, 20 January 2015 at 1:20 PM

TDLmake works now if I specify the path to tdlmake as part of the string passed to os.system. However, multiple command strings such as "cd "/Users/deastham/Desktop/RIBoutput"; /Applications/3Delight/bin/renderdl -D /Users/deastham/Desktop/RIBoutput/dgfg_0.rib" still don't work. (I am making sure to use the escape codes for slashes correctly. They are also used in the tdlmake calls.