Run python file through script

dgkanavias
New Contributor

Hi , i tried to run a python file through a script , but i receive errors from that file .

BUT when i run it from terminal everything works fine .

Do you have any idea what the problem may be?

3 REPLIES 3

adamcodega
Valued Contributor

Could you post the script you are using? (Use the script formatting)

Also, Python is a script that can run on Mac OS X natively so you don't need to run it from a script unless there was a reason you were calling it that way.

dgkanavias
New Contributor

I need to run a .py to make some changes to the notification center .

-> #!/bin/sh

-> #!/usr/bin/env python

-> python /Documents/NCutil.py --alert-style alerts com.eukaryote.RSS

bkerns
New Contributor II

I run python scripts from Casper quite regularly. You don't want two #! lines. Start your script with only "#!/usr/bin/python", which instructs it to use Python as the interpreter.

I guess another way to say it would be - don't call your python script from a Bash script within Casper. Just put the python directly into Casper.