Bad File Descriptor - Heroku Foreman
Question: I'm trying to run _hello.py_ from [this Python Heroku
tutorial](https://devcenter.heroku.com/articles/python). My problems began
after running this command: `foreman start`. I got the following error even
though I installed the [Heroku Toolbelt](https://toolbelt.heroku.com/):

> foreman is not recognized as an internal or external command, operable
> program or batch file

So I added the location of the foreman file (version 0.63.0) to my _path_ :

> C:\Program Files (x86)\Heroku\ruby-1.9.2\bin

and restarted the command prompt and reran `foreman start`. Now, I'm getting
this error:

    
    
    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>
    

**hello.py**

    
    
    import os
    from flask import Flask
    
    app = Flask(__name__)
    
    @app.route('/')
    def hello():
        return 'Hello World'
    

**Procfile**

    
    
    web: gunicorn hello:app
    

**EDIT 1**

After reading [this answer](http://stackoverflow.com/questions/15399637/cant-
start-foreman-in-heroku-tutorial-using-python), I did the following:

    
    
    gem uninstall foreman   
    gem install foreman -v 0.61.0
    

However, when I reran `foreman start` I'm getting this error now

    
    
    (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>
    

Any assistance will be really appreciated. Thanks in advance.


Answer: I fixed this problem by running the following:

    
    
    gem uninstall foreman
    gem install foreman -v 0.61.0 [EDIT]
    

As mentioned [here](http://stackoverflow.com/questions/15399637/cant-start-
foreman-in-heroku-tutorial-using-python).

