about automatically run python code

Supporting 2.7 and 3.2+
Post Reply
Cuijwyn
Phidgetsian
Posts: 10
Joined: Sun Aug 15, 2021 11:49 pm
Contact:

about automatically run python code

Post by Cuijwyn »

I have a python code that can run SBC4 with SSH, but I upload to SBC with SBC4 web, and make it run automatically, but it does not work, and give the errors:
/usr/userapps/python/removeOldMiniseed.py: 7: /usr/userapps/python/removeOldMiniseed.py:
Created on Thu Jul 6 22:13:14 2023

@author: cuijw
: not found
/usr/userapps/python/removeOldMiniseed.py: 9: /usr/userapps/python/removeOldMiniseed.py: import: not found
/usr/userapps/python/removeOldMiniseed.py: 10: /usr/userapps/python/removeOldMiniseed.py: import: not found
from: can't read /var/mail/threading
/usr/userapps/python/removeOldMiniseed.py: 13: /usr/userapps/python/removeOldMiniseed.py: Syntax error: "(" unexpected

I add #!/usr/userapps/python/ in the code head , then I get error: /etc/webif/init.d/S20python: 41: /etc/webif/init.d/S20python: /usr/userapps/python/removeOldMiniseed.py: Permission denied

How should I do?
User avatar
Patrick
Lead Developer
Posts: 616
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: about automatically run python code

Post by Patrick »

Hi,

You need to add to the start of your .py file:

#!/usr/bin/env python3

-Patrick
Post Reply

Who is online

Users browsing this forum: No registered users and 42 guests