I have two files. They both work. 1st one is aspscheduler script which run 2nd script every xx time(not too fast to exluce this case). When it comes to execute 2nd script I got this error:
./sql.py: 2: ./sql.py: import: not found
./sql.py: 4: ./sql.py: import: not found
./sql.py: 5: ./sql.py: import: not found
./sql.py: 7: ./sql.py: ROOT: not found
./sql.py: 8: ./sql.py: tempixy: not found
./sql.py: 9: ./sql.py: Syntax error: "(" unexpected
But everything works when I execute 2nd script manually.
First 10 lines of code from 2nd script:
#import mysql.connector
import MySQLdb
#from MySQLdb import errorcode
import os
import re
ROOT = '/sys/bus/w1/devices'
tempixy = []
for sensor in os.listdir(ROOT):
Thanks for your taking your time! Good night.
@@@ For hungryones for my 1st script: pastebin.com/zpuUmYyg
You are most probably trying to execute it as a shell script. Assuming you are using a linux/unix-like operating system, try adding the following line at the start of the script:
`#!/usr/bin/env python`
Also make the file executable:
`sudo chmod +x sql.py`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With