Python 错误的文件描述符-Heroku Foreman
我正在试着运行hello.py。运行此命令后,我的问题开始出现:Python 错误的文件描述符-Heroku Foreman,python,heroku,python-2.7,windows-8,heroku-toolbelt,Python,Heroku,Python 2.7,Windows 8,Heroku Toolbelt,我正在试着运行hello.py。运行此命令后,我的问题开始出现:foreman start。尽管我安装了,但仍出现以下错误: 工头不被视为内部或外部指挥,可操作 程序或批处理文件 因此,我在路径中添加了foreman文件(版本0.63.0)的位置: C:\ProgramFiles(x86)\Heroku\ruby-1.9.2\bin 然后重新启动命令提示符并重新运行foreman start。现在,我得到了这个错误: Microsoft Windows [Version 6.2.9200] (c
foreman start
。尽管我安装了,但仍出现以下错误:
工头不被视为内部或外部指挥,可操作
程序或批处理文件
因此,我在路径中添加了foreman文件(版本0.63.0)的位置:
C:\ProgramFiles(x86)\Heroku\ruby-1.9.2\bin
然后重新启动命令提示符并重新运行foreman start
。现在,我得到了这个错误:
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
C:\Users\me\Desktop\Code\heroku_python_app>venv\Scripts\activate
(venv) C:\Users\me\Desktop\Code\heroku_python_app>foreman start
Bad file descriptor
C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0
/lib/foreman/engine.rb:372:in `read_nonblock'
C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0
/lib/foreman/engine.rb:372:in `block (2 levels) in watch_for_output'
C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0
/lib/foreman/engine.rb:368:in `loop'
C:/Program Files (x86)/Heroku/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/foreman-0.63.0
/lib/foreman/engine.rb:368:in `block in watch_for_output'
12:57:38 web.1 | exited with code 1
12:57:38 system | sending SIGKILL to all processes
(venv) C:\Users\me\Desktop\Code\heroku_python_app>
你好.py
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World'
Procfile
web: gunicorn hello:app
编辑1
读完后,我做了以下几点:
gem uninstall foreman
gem install foreman -v 0.61.0
gem uninstall foreman
gem install foreman -v 0.61.0 [EDIT]
然而,当我重新运行foreman start
时,我现在得到了这个错误
(venv) C:\Users\me\Desktop\Code\heroku_python_app>foreman start
14:13:20 web.1 | started with pid 252
14:13:20 web.1 | exited with code 1
14:13:20 system | sending SIGKILL to all processes
14:13:20 | Traceback (most recent call last):
14:13:20 | File "C:\Users\me\Desktop\Code\heroku_python_app\venv\Scri
pts\gunicorn-script.py", line 9, in <module>
(venv) C:\Users\me\Desktop\Code\heroku_python_app>
(venv)C:\Users\me\Desktop\code\heroku\u python\u app>领班开始
14:13:20 web.1 |从pid 252开始
14:13:20 web.1 |以代码1退出
14:13:20系统|向所有进程发送SIGKILL
14:13:20 |回溯(最后一次最近通话):
14:13:20 |文件“C:\Users\me\Desktop\Code\heroku\u python\u app\venv\Scri
pts\gunicorn script.py”,第9行,在
(venv)C:\Users\me\Desktop\Code\heroku\u python\u app>
任何帮助都将不胜感激。提前感谢。我通过运行以下命令修复了此问题:
gem uninstall foreman
gem install foreman -v 0.61.0
gem uninstall foreman
gem install foreman -v 0.61.0 [EDIT]
如前所述。您能在没有Foreman的情况下从Procfile运行web命令吗?您的Procfile应该包含一行,如
web:something
,只需在命令行中键入something
部分,然后查看发生了什么。您找到解决方案了吗?我也有同样的问题。+1@RexE据我所知,这个问题是由于Windows不支持Gunicorn(我使用的是Windows XP)导致的。请查看他们的网站()。不过,我将在Linux CentOS上再次尝试,并将向您汇报。仅供参考,我也尝试在虚拟机上运行Ubuntu,但是,我的系统太慢,虚拟机无法正常工作。所以我用CentOS双重启动了我的机器,我很快就会重试。另一种选择是创建一个AmazonEC2实例,选择他们的一个Linux AMI,并在那里进行尝试。我已经成功了!我相信,它是在我创建了SSH密钥之后开始工作的。