Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Python script does not work when run through system.callSystem(cmd)

  • Python script does not work when run through system.callSystem(cmd)

    Posted by Yaavi Foxy on January 24, 2019 at 2:11 pm

    I want to run a python script through system.callSystem in an after effects JSX file. I have done that successfully, but when it comes to opening and writing files in the python script, it does not work. As far as I can tell, there’s nothing wrong with the python code, I have executed it many times in the command prompt and it works perfectly (creates the file and writes data to it).

    The javascript code:


    var result = system.callSystem("python C:\\Users\\HP\\test.py");

    The python code: (writing a simple text file)

    file = 'aTextFile.txt'
    with open(file,'w') as f:
    f.write('hello this is a test again, second one')
    print('check your folder')

    Any suggestions or other workarounds that I might not be aware of are welcome, thank you!

    Yaavi Foxy replied 7 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Walter Soyka

    January 25, 2019 at 5:53 pm

    Two thoughts:

    1) Maybe it’s running, but the working directory is not what you expect .

    2) Maybe you need to pass the call to python via cmd.exe /c

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Yaavi Foxy

    January 26, 2019 at 8:37 pm

    Thanks! I tried the second one yesterday and it worked. I was actually trying to fetch an image from a URL, I thought about using the Requests python library since I had a couple of issues with the socket object. I ended up using the “wget” through the command prompt and it worked (It still shows me an ugly cmd interface though). I would really appreciate it if you could show me how to get the socket object to work without any problems (If you happen to have experience with it). Is it usually too complicated to work with, or is it just me?

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy