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

Tornado assumes invalid signature for parse_qs on Python 3.1 #2936

Closed
holdenweb opened this issue Feb 15, 2013 · 1 comment
Closed

Tornado assumes invalid signature for parse_qs on Python 3.1 #2936

holdenweb opened this issue Feb 15, 2013 · 1 comment
Milestone

Comments

@holdenweb
Copy link

My first install of IPython Notebook on Python 3 (albeit a somewhat venerable one) in a clean virtualenv gave me a stack trace when I tried to access it from the web. The problem arises in tornado/escape.py.

It appears the issue is that neither of the two alternative imports of parse_qs at line 37 (urllib.parse or cgi) make provision for an "encoding" or "errors" keyword argument, which unfortunately parse_qs_bytes is providing both of on line 151.

For the record, removing the arguments to leave line 150 reading

    result = parse_qs(qs, keep_blank_values, strict_parsing)

seems superficially to work, but I have not considered the wider ramifications as I do not currently have either the context or the headspace to do so. The real solution for me is to upgrade my Python 3 to version 3.2 or better, which makes those keyword arguments admissible in urllib.urlparse.parse_qs.

This is on Python 3.1.3, MacOS 10.6.8 with the following pip-installed packages supporting

distribute==0.6.24
ipython==0.13.1
pyzmq==2.2.0.1
tornado==2.4.1
wsgiref==0.1.2

Traceback follows. Feel free to close this issue immediately if you aren't supporting Python 3.1.

(py3)AirHead:~ sholden$ ipython3 notebook
[NotebookApp] Using existing profile dir: '/Users/sholden/.ipython/profile_default'
[NotebookApp] Serving notebooks from /Users/sholden
[NotebookApp] The port 8888 is already in use, trying another random port.
[NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8889/
[NotebookApp] Use Control-C to stop this server and shut down all kernels.
ERROR:root:Uncaught exception, closing connection.
Traceback (most recent call last):
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/iostream.py", line 311, in wrapper
callback(_args)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 256, in _on_headers
headers=headers, remote_ip=remote_ip)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 391, in init
arguments = parse_qs_bytes(self.query)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/escape.py", line 151, in parse_qs_bytes
encoding='latin1', errors='strict')
TypeError: parse_qs() got an unexpected keyword argument 'encoding'
ERROR:root:Exception in callback <zmq.eventloop.stack_context._StackContextWrapper object at 0x1021e0628>
Traceback (most recent call last):
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/zmq/eventloop/ioloop.py", line 440, in _run_callback
callback()
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/iostream.py", line 311, in wrapper
callback(_args)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 256, in _on_headers
headers=headers, remote_ip=remote_ip)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 391, in init
arguments = parse_qs_bytes(self.query)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/escape.py", line 151, in parse_qs_bytes
encoding='latin1', errors='strict')
TypeError: parse_qs() got an unexpected keyword argument 'encoding'
ERROR:root:Uncaught exception, closing connection.
Traceback (most recent call last):
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/iostream.py", line 311, in wrapper
callback(_args)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 256, in _on_headers
headers=headers, remote_ip=remote_ip)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 391, in init
arguments = parse_qs_bytes(self.query)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/escape.py", line 151, in parse_qs_bytes
encoding='latin1', errors='strict')
TypeError: parse_qs() got an unexpected keyword argument 'encoding'
ERROR:root:Exception in callback <zmq.eventloop.stack_context._StackContextWrapper object at 0x1022a5cb0>
Traceback (most recent call last):
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/zmq/eventloop/ioloop.py", line 440, in _run_callback
callback()
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/iostream.py", line 311, in wrapper
callback(_args)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 256, in _on_headers
headers=headers, remote_ip=remote_ip)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 391, in init
arguments = parse_qs_bytes(self.query)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/escape.py", line 151, in parse_qs_bytes
encoding='latin1', errors='strict')
TypeError: parse_qs() got an unexpected keyword argument 'encoding'
ERROR:root:Uncaught exception, closing connection.
Traceback (most recent call last):
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/iostream.py", line 311, in wrapper
callback(_args)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 256, in _on_headers
headers=headers, remote_ip=remote_ip)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 391, in init
arguments = parse_qs_bytes(self.query)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/escape.py", line 151, in parse_qs_bytes
encoding='latin1', errors='strict')
TypeError: parse_qs() got an unexpected keyword argument 'encoding'
ERROR:root:Exception in callback <zmq.eventloop.stack_context._StackContextWrapper object at 0x1022a5e10>
Traceback (most recent call last):
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/zmq/eventloop/ioloop.py", line 440, in _run_callback
callback()
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/iostream.py", line 311, in wrapper
callback(_args)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 256, in _on_headers
headers=headers, remote_ip=remote_ip)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 391, in init
arguments = parse_qs_bytes(self.query)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/escape.py", line 151, in parse_qs_bytes
encoding='latin1', errors='strict')
TypeError: parse_qs() got an unexpected keyword argument 'encoding'
ERROR:root:Uncaught exception, closing connection.
Traceback (most recent call last):
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/iostream.py", line 311, in wrapper
callback(_args)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 256, in _on_headers
headers=headers, remote_ip=remote_ip)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 391, in init
arguments = parse_qs_bytes(self.query)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/escape.py", line 151, in parse_qs_bytes
encoding='latin1', errors='strict')
TypeError: parse_qs() got an unexpected keyword argument 'encoding'
ERROR:root:Exception in callback <zmq.eventloop.stack_context._StackContextWrapper object at 0x1022a5f70>
Traceback (most recent call last):
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/zmq/eventloop/ioloop.py", line 440, in _run_callback
callback()
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/iostream.py", line 311, in wrapper
callback(_args)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 256, in _on_headers
headers=headers, remote_ip=remote_ip)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/httpserver.py", line 391, in init
arguments = parse_qs_bytes(self.query)
File "/Users/sholden/.virtualenvs/py3/lib/python3.1/site-packages/tornado/escape.py", line 151, in parse_qs_bytes
encoding='latin1', errors='strict')
TypeError: parse_qs() got an unexpected keyword argument 'encoding'

@takluyver
Copy link
Member

We did support Python 3.1 up to our 0.13 release, I think. But if there's a bug in Tornado, you'll need to contact them. It looks like they don't support 3.1 (here's a previous PR), but if you want to try, that's up to you.

But really, I think you're better off just upgrading Python. Support for Python 3 is improving fast, but all the projects I've seen take 3.2 as the minimum.

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

2 participants