简体   繁体   English

Debian Jessie上的Python问题

[英]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. 我最近从Pi B +升级到了在Debian Jessie上运行的Pi 2。 I am using my Pi as a web-based kiosk and web-based internet radio server. 我将Pi用作基于Web的信息亭和基于Web的互联网广播服务器。 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. 该脚本在Wheezy上运行,甚至在Jessie上启动我的应用程序。 However, when trying to start part of the application I am now getting an error related to Python. 但是,当尝试启动应用程序的一部分时,我现在遇到与Python相关的错误。 I am not very experienced with Debian and seem to be missing a file or dependency needed to run my application. 我对Debian不太熟悉,似乎缺少运行我的应用程序所需的文件或依赖项。 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. 我已经尝试通过使用命令“ apt-get install python2.7”来确保已安装python 2.7并保持最新状态,但是我已经安装了最新版本。 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. 我必须在脚本文件“ pianobar_web.py”的第67行中将路径更改为“ pianobar”,以反映该应用程序的完整路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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