FORUMS: list search recent posts

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

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Yaavi Foxy
Python script does not work when run through system.callSystem(cmd)
on Jan 24, 2019 at 2:11:34 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!


Return to posts index

Walter Soyka
Re: Python script does not work when run through system.callSystem(cmd)
on Jan 25, 2019 at 5:53:21 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 [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Yaavi Foxy
Re: Python script does not work when run through system.callSystem(cmd)
on Jan 26, 2019 at 8:37:16 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?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]