大家早上好。我正在寻找一些帮助,弄清楚到底是怎么回事,我收到了一个错误。最近,我从Pi B+升级到了运行在Debian上的Pi 2。我正在使用我的Pi作为一个基于网络的信息亭和基于网络的网络无线电服务器。在启动时,我运行以下脚本:
#!/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 /这个脚本可以在Wheezy上运行,甚至可以使用Jessie来启动我的应用程序。但是,当尝试启动应用程序的一部分时,我现在收到了一个与Python相关的错误。我对Debian不太熟悉,似乎缺少运行我的应用程序所需的文件或依赖关系。有关信息,请参见下面的错误消息:
> 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我已经尝试过使用命令“apt Installpython2.7”来确保python2.7已经安装并更新了,但是我已经安装了最新版本。任何帮助都将不胜感激。
谢谢!
发布于 2016-02-17 19:15:05
File "pianobar_web.py", line 67, in authenticate
proc = subprocess.Popen("pianobar", stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)我终于找到解决办法了。我不得不将"pianobar_web.py“脚本文件第67行中的路径更改为"pianobar”,以反映该应用程序的完整路径。
发布于 2016-02-17 15:05:23
假设文件pianobar位于您执行的.py文件旁边,您可以调用Popen('./pianobar', ....。或者,在调用Python之前,将目录添加到shell脚本中的PATH变量。
https://stackoverflow.com/questions/35460132
复制相似问题