I dont know much about python. I want to start working on the project and the setup instruction says:
pip install -r requirements-dev.txt
Simple enougth. The problem is that I get this:
Downloading/unpacking gunicorn==0.13.4 (from -r requirements.txt (line 7))
Running setup.py egg_info for package gunicorn
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/gunicorn/setup.py", line 18, in <module>
long_description = file(
NameError: name 'file' is not defined
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/gunicorn/setup.py", line 18, in <module>
long_description = file(
NameError: name 'file' is not defined
I dont understand the problem. Maybe somebody can help out?
I run this on Arch Linux, python defaults to python 3 and the project is not python 3 but Im not sure if thats it.
Thanks.
The Python "NameError: function is not defined" occurs when we try to call a function that is not declared or before it is declared. To solve the error, make sure you haven't misspelled the function's name and call it after it has been declared.
The most common cause of “NameError: name 'file' is not defined” is running Python 2 code in Python 3. The fix for this is simply to use Python 2, or to update your code for Python 3.
The Python "NameError: name is not defined" occurs when we try to access a variable or function that is not defined or before it is defined. To solve the error, make sure you haven't misspelled the variable's name and access it after it has been declared. Here is an example of how the error occurs.
file()
is not supported in Python 3
Use open()
instead; see Built-in Functions - open().
It seems that your project is written in Python < 3. This is because the file()
builtin function is removed in Python 3. Try using Python 2to3 tool or edit the erroneous file yourself.
EDIT: BTW, the project page clearly mentions that
Gunicorn requires Python 2.x >= 2.5. Python 3.x support is planned.
file is not defined in Python3, which you are using apparently. The package you're instaling is not suitable for Python 3, instead, you should install Python 2.7 and try again.
See: http://docs.python.org/release/3.0/whatsnew/3.0.html#builtins
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With