Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: global name 'fileno' is not defined #1179

Closed
bristi opened this issue Jan 4, 2016 · 3 comments
Closed

NameError: global name 'fileno' is not defined #1179

bristi opened this issue Jan 4, 2016 · 3 comments

Comments

@bristi
Copy link

bristi commented Jan 4, 2016

Serving a Django or Flask application throws exception NameError: global name 'fileno' is not defined. Version 19.4.3 works.

This is my stack trace:

[2016-01-04 22:06:19 +0100] [66398] [ERROR] Error handling request /static/js/admin_events.js
Traceback (most recent call last):
File "/Users/brian/VEnvs/flask-newsocketio/lib/python2.7/site-packages/gunicorn/workers/async.py", line 52, in handle
self.handle_request(listener_name, req, client, addr)
File "/Users/brian/VEnvs/flask-newsocketio/lib/python2.7/site-packages/gunicorn/workers/async.py", line 110, in handle_request
resp.write_file(respiter)
File "/Users/brian/VEnvs/flask-newsocketio/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 396, in write_file
if not self.sendfile(respiter):
File "/Users/brian/VEnvs/flask-newsocketio/lib/python2.7/site-packages/gunicorn/http/wsgi.py", line 360, in sendfile
offset = os.lseek(fileno, 0, os.SEEK_CUR)
NameError: global name 'fileno' is not defined

Also see thread (I am not the creator) :
http://stackoverflow.com/questions/34600218/gunicorn-nameerror-global-name-fileno-is-not-defined/34600808#34600808

Let me know if I can help out further.

cheers,
-brian

@jeffbean
Copy link

jeffbean commented Jan 4, 2016

Hit this with python 3.3 as well

 [2016-01-04 22:35:05 +0000] [26] [ERROR] Error handling request /static/img/favicon.ico
Traceback (most recent call last):
 File "/usr/local/lib/python3.3/site-packages/gunicorn/workers/sync.py", line 130, in handle
     self.handle_request(listener, req, client, addr)
   File "/usr/local/lib/python3.3/site-packages/gunicorn/workers/sync.py", line 174, in handle_request
     resp.write_file(respiter)
   File "/usr/local/lib/python3.3/site-packages/gunicorn/http/wsgi.py", line 396, in write_file
     if not self.sendfile(respiter):
   File "/usr/local/lib/python3.3/site-packages/gunicorn/http/wsgi.py", line 360, in sendfile
     offset = os.lseek(fileno, 0, os.SEEK_CUR)
 NameError: global name 'fileno' is not defined

@jmoiron
Copy link

jmoiron commented Jan 4, 2016

#1178 should fix this

@berkerpeksag
Copy link
Collaborator

Thanks for the report. @jmoiron is right. This is fixed in master. We will release a new version tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants