Skip to main content
Participant
March 7, 2014
Question

Calling a python Script from an AE Script

  • March 7, 2014
  • 2 replies
  • 1785 views

I'm trying to create a little automation script to inegrate my studios's pipline with our Shotgun page.

I have the python cript working as "myScripy.py <arguments>" Where arguments are comp names to be updated.

i was hoping i could create an array of selected comps and run the script once for each using:

myPythonScript = "c:\\PythonScripts\\myScript.py " + selectedCompNameVariable

system.callSystem(myPythonScript)

It appears to attempt to call the pythong script via command line, but i get the following error:

"After Effects warning: ERROR: %1 is not a valid Win32 application"

Why is this? Can I not call a python script on my computer via this command?

This topic has been closed for replies.

2 replies

March 8, 2014

Legend
March 7, 2014

You should be able to, but maybe the environment is different than what you expect when you use system.callSystem.  Have you tried using cmd?  Something like this maybe:

pythonCmd = "cmd /c \"c:\\\\PythonScripts\\\\myScript.py\" " + selectedCompNameVariable;

system.callSystem(pythonCmd);

What do you get when you type in the string you concatenate in a windows command line shell?  Does the script run successfully?

Participant
March 7, 2014

i set up an alert(myPythonScript) just to make sure the string looked right and when i type it into the command line it works fine.

I think you may be right taht i need to call it as cmd though .. since technically the script is not a program but rather a script run in cmd ... let me try that and i'll get back to you