简体   繁体   中英

Issue with Python on Debian Jessie

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:

#!/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!

假设文件pianobar位于执行的.py文件旁边,则可以调用Popen('./pianobar', ....或者,在调用Python之前,将目录添加到shell脚本中的PATH变量中。

File "pianobar_web.py", line 67, in authenticate
proc = subprocess.Popen("pianobar", stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

I found the fix finally. I had to change the path to "pianobar" in line 67 of the "pianobar_web.py" script file to reflect the full path to the app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM