THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/09/2012 at 08:02, xxxxxxxx wrote:
Hi everybody,
i am trying to write a plugin for c4d to start an external render or to send a command to our renderfarm to render a specific c4d file. well, i didn't came far. i am stuck with sending a command to the operating system to run a program (wich is our server client). so the basic idea is just simple: by clicking on the plugin, it just sends a command over the system shell. later if this runs i want to parse specific informations of the c4d scene (like start and endframe, file location, render location etc. but that's simple, shouldn't be a problem). I was trying to achieve this via the subprocess library of python.
question now is:
- what is the right way to send a command to the shell of the os?
- is it even possible to send such commands from within c4d-python?
here is the testcode i've written. i have been trying several variations of this but none did work...
i am on osx 10.6 mac...
here's the testcode:
-----------------------------------------------------------------------------------------------
import c4d
from c4d import gui
import os
import subprocess
def main() :
print("Hello!") #to test if it's running
subprocess.Popen(['cd /Applications/rprccmd && ./rprccmd'], shell=True)
if __name__=='__main__':
main()
-----------------------------------------------------------------------------------------------
i wrote a testprogram in c++ via xcode which worked. when i did put it in c++ plugin structure for c4d it didn't work either...
any ideas would be highly appreciated
cheers,
Michael