Skip to main content
Question

Run python file through script

  • September 29, 2015
  • 3 replies
  • 7 views

Forum|alt.badge.img+4

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

acodega
Forum|alt.badge.img+15
  • Valued Contributor
  • 383 replies
  • September 29, 2015

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.


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 15 replies
  • September 29, 2015

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


Forum|alt.badge.img+7
  • Contributor
  • 26 replies
  • September 29, 2015

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.