Debian Jessie 上的 Python 问题
Issue with Python on Debian Jessie
大家早上好。我正在寻找一些帮助来弄清楚我收到的错误究竟是怎么回事。我最近在 Debian Jessie 上从 Pi B+ 升级到 Pi 2 运行ning。我将我的 Pi 用作基于 Web 的信息亭和基于 Web 的互联网广播服务器。在启动时,我运行正在执行以下脚本:
#!/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-get install python2.7" 确保 python 2.7 已安装并保持最新,但我已经安装了最新版本。任何帮助将不胜感激。
谢谢!
假设文件 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)
我终于找到了解决方法。我必须在 "pianobar_web.py" 脚本文件的第 67 行中将路径更改为 "pianobar" 以反映应用程序的完整路径。
大家早上好。我正在寻找一些帮助来弄清楚我收到的错误究竟是怎么回事。我最近在 Debian Jessie 上从 Pi B+ 升级到 Pi 2 运行ning。我将我的 Pi 用作基于 Web 的信息亭和基于 Web 的互联网广播服务器。在启动时,我运行正在执行以下脚本:
#!/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-get install python2.7" 确保 python 2.7 已安装并保持最新,但我已经安装了最新版本。任何帮助将不胜感激。
谢谢!
假设文件 pianobar
位于您执行的 .py
文件旁边,您可以调用 Popen('./pianobar', ....
。或者,在调用 Python.
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" 以反映应用程序的完整路径。