n8klayko
Posts: 3
Joined: Wed Feb 17, 2016 2:20 pm

Issue with Python on Jessie

Wed Feb 17, 2016 2:43 pm

Good morning all. I am looking for some help figuring out what exactly is going on with an error I am receiving. I recently upgraded from a Pi B+ to a Pi 2 running on Debian Jessie. I am using my Pi as a web-based kiosk and web-based internet radio server. At startup, I am running the following script:

Code: Select all

	#!/bin/sh
	# launcher.sh
	# navigate to home directory, then to this directory, then execute python script, then back home

	cd /
	cd /home/pi/Desktop/Pianobar-Web
	python pianobar_web.py
	cd /
This script worked on Wheezy and is even working on Jessie to start my application. However, when trying to start part of the application I am now getting an error related to Python. I am not very experienced with Debian and seem to be missing a file or dependency needed to run my application. Please see the error message below for information:
Error: 500 Internal Server Error

Sorry, the requested URL 'http://192.168.0.125:8080/auth' caused an error:
Internal Server Error

Exception:
OSError(2, 'No such file or directory')

Traceback:
Traceback (most recent call last):
File "/home/pi/Pianobar-Web/bottle.py", line 845, in _handle
return route.call(**args)
File "/home/pi/Pianobar-Web/bottle.py", line 1709, in wrapper
rv = callback(*a, **ka)
File "pianobar_web.py", line 67, in authenticate
proc = subprocess.Popen("pianobar", stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
I have tried making sure that python 2.7 is installed and up-to-date by using the command "apt-get install python2.7", but I already have the most recent version installed. Any help would be greatly appreciated.

Thank you!

Aydan
Posts: 729
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: Issue with Python on Jessie

Wed Feb 17, 2016 4:33 pm

Code: Select all

File "pianobar_web.py", line 67, in authenticate
proc = subprocess.Popen("pianobar", stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
You should specify the whole path to pianobar here. $PATH is probably different because the context of where the script is started is different.

Regards
Aydan

n8klayko
Posts: 3
Joined: Wed Feb 17, 2016 2:20 pm

Re: Issue with Python on Jessie

Wed Feb 17, 2016 6:42 pm

If I run the script manually from terminal the script works fine though. Are you thinking I should change the "pianobar" app path to the full path? Why would it work when run manually, but not when it is run at startup from crontab?

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Issue with Python on Jessie

Wed Feb 17, 2016 6:44 pm

Because a crontab has a different $PATH than an interactive shell ? It's a well-known "feature" of crontabs.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

n8klayko
Posts: 3
Joined: Wed Feb 17, 2016 2:20 pm

Re: Issue with Python on Jessie

Wed Feb 17, 2016 7:05 pm

That did it! Thank you!!! :D

Return to “Advanced users”