qmasingarbe / pymiere

Python for Premiere pro
GNU General Public License v3.0
363 stars 46 forks source link

eval_script filepath issue #29

Closed fixinPost closed 3 years ago

fixinPost commented 3 years ago

Hi, I'm having an issue with the eval_script function from core.py. I can give it a string of extendscript code and that code is executed correctly, but when I try using a file pathstring that points to a jsx, file I get 'EvalScript error.' I'm not sure if it's a syntax error. I'm currently on Mac, but I had the same issue on windows.

my code : eval_script('/Users/myUserName/Desktop/stamp.jsx')

I also tried eval_script(r'/Users/myUserName/Desktop/stamp.jsx')

Has anyone else had any issues with this function? I seem to recall being able to do successfully give it file paths when I tested it a few months ago, but now I can't. is it a syntax error on my part? Does anyone else have this problem?

qmasingarbe commented 3 years ago

Hi, You have to use eval_script(filepath="..."). If you don't use the filepath keyword it will try to exec your path as a code line. Let me know if that worked

fixinPost commented 3 years ago

I just tried your advice and received this new error:

eval_script(filepath= "/Users/myUserName/Desktop/pymiere-master/helloWorld.jsx") Traceback (most recent call last): File "", line 1, in File "core.py", line 80, in eval_script with open(filepath, encoding='utf-8-sig') as f: TypeError: 'encoding' is an invalid keyword argument for this function

thank you for your time. update: I was using Catalina's built in 2.7 python and got the error. I ran the same line of code in python3 and it worked.

qmasingarbe commented 3 years ago

Right, there was a compatibility problem for python 2 in the code reading the file. I fixed it, you can update your pymiere from github or pip and you should be able to use your code in python 2.7.