1

I've created a Python program for my raspberry PI with Raspbian. When I run it using IDLE3 (my program has been created with Python 3.2), it works fine. As I'd like to run this python script at startup, I'm trying to launch it in terminal using the following command

Python3 /home/pi/myProgram.py

myProgram.py starts but when it tries to open an INI file an error occures on ConfigParser. Question: If myProgram.py works fine in IDLE3, it should works using the terminal too, right?

  • 1
    Does the program use the full path to the ini file, e.g. open("/home/pi/my.ini", "r")? If it uses a relative path such as open ("my.ini", "r") it may fail as your working directory will probably not be /home/pi when you launch the script. – joan Jul 6 '15 at 8:26
  • Is python3 link starting python 3.2 version? Try starting python3 without any argument and check disclaimer for your version. Perhaps there are more versions installed. – Piotr Kamoda Jul 6 '15 at 8:26
  • @PiotrKamoda: Or to be more efficient, use python3 --version. Then you don't have to bother with launching Python in its entirety. – Jacobm001 Jul 6 '15 at 16:18
  • What is the error being raised by ConfigParser? The issues that come to mind would be a path problem, a permissions problem or an environment problem. If your comment is correct and you have "import ConfigParser" in your .py file, than IDLE3 is most likely using python 2.x. In python 3 ConfigParser has been renamed configparser. I know this because I ran into this issue ... experience can make anyone seem smart. – ifermon Jul 6 '15 at 16:55
  • You are right! I was using a relative path. Now, using an absolute path, it works fine. Thx a lot – Fourier Jul 8 '15 at 8:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.