I have a python script on a Raspberry Pi reading the temperature and humidity from a sensor. It works fine when started in IDLE, but when I try starting it in a terminal I get the message:sudo: unable to execute .thermostaatgui.py: No such file or directory. The first line in the script is: #! /usr/bin/python, the same as in other scripts that run without problems and the script is made executable with chmod +x.
In the script Adafruit_DHT, datetime and time are imported, other scripts that work do the same.
Well, still a little puzzled why it happened, but anyway this solved the problem:
As a workaround, I copied the contents of "thermostaatgui.py" over the contents of a working script ("mysimpletest.py"), saved it and it runs OK.
python executing in IDLE, but not in termnal