0

The standard python version of ubuntu 13.04 is python 2.7. I know that I can call a python script of version 3.3 by calling python3.3 or python3 in terminal instead of only "python", which starts the version 2.7...

e.g. python3 myscript.py

But now I have a version 3.3. script in the system start routine and can only tell the path to the file. The system recognizes it as a python script (in the shebang with #!/usr/bin/python3) But how to open it with the correct version? It is tried to be opened with the standard python install so it wont work nor even show up.

user2366975
  • 4,350
  • 9
  • 47
  • 87
  • The `#!/usr/bin/python3` should do the trick, I think. Have you tried running a script that only prints the Python version, and redirecting the output to a file (so you can check it after it finishes)? – Emil Lundberg Jul 01 '13 at 20:25
  • I havent tried printing yet, good idea – user2366975 Jul 01 '13 at 21:02
  • This question has already been asked. Take a look at [1]: http://stackoverflow.com/questions/13718821/run-python-script-as-daemon-at-boot-time-ubuntu – Saqib Ahmed Aug 15 '13 at 19:12

1 Answers1

0

The shebang line #!/usr/bin/python3 should work if sh, bash, etc. is trying to launch your script.

It it is being run from another script as python myscript.py you'll have to find that script and get it to launch the script using python3 myscripy.py

John La Rooy
  • 295,403
  • 53
  • 369
  • 502
  • Hm I dont understand, I also think it should work. E.g. there is a programm that is called with "/opt/extras.ubuntu.com/indicator-stickynotes/indicator-stickynotes.py", the file is owned by root. my file is placed in /home, owned by me and called the same way, both have the same shebangs (python3). But my file does not open – user2366975 Jul 01 '13 at 20:59
  • I changed the call in the system startup routine to "python3 /home/me/abcdcasdf.py and now it works. strange that it only worked on the second reboot, but ok. – user2366975 Jul 01 '13 at 21:39