You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
something is wrong in your setup then. I suspect you have a mismatch between the python version you think you are running the one you are actually running, and/or which library code it is accessing.
fromwsgiref.simple_serverimportmake_server, demo_appwithmake_server('', 8000, demo_app) ashttpd:
print("Serving HTTP on port 8000...")
httpd.serve_forever()
My Python installation is a default x64 installation. No changes were made during installation, except installation path, which has no spaces in it. I have no third part modules installed which could interfer. I have also a Python 2.7 installed but it is not on my path.
Nils-Hero commented on Jun 6, 2017
Nils-Heromannequin
MannequinAuthor
More actions
I just found out that the example works in idle and if i do in a console:
If you just type 'server.py' it will use whichever interpreter is associated with .py files, which might not be python3. You may want to learn about the 'py' helper command.
I am not sure if the py package i found on PyPi is what you meant, but if you mean the py launcher (the py.exe in the windows dir), yes, i have that.
My system was indeed misconfigured as you correctly guessed, i had the .py filetype pointing to a Python version 3.5. I have now uninstalled everything, manually cleaned up the registry, reinstalled Python 3.6 and now everything works. Sorry, my mistake.
Activity
Nils-Hero commentedon Jun 6, 2017
All examples on
https://docs.python.org/3/library/wsgiref.html
raise this exception:
Tested with
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
bitdancer commentedon Jun 6, 2017
something is wrong in your setup then. I suspect you have a mismatch between the python version you think you are running the one you are actually running, and/or which library code it is accessing.
bitdancer commentedon Jun 6, 2017
Either that or you aren't really running the make_server from wsgiref.simple_server.
Nils-Hero commentedon Jun 6, 2017
I tried a few online python 3 interpreters.
These give the same exception:
http://www.learnpython.org/en/Hello%2C_World%21
http://rextester.com/l/python3_online_compiler
http://ideone.com/pIMilt
http://www.tutorialspoint.com/execute_python3_online.php
And this one worked:
https://repl.it/languages/python3
the example i tried was:
My Python installation is a default x64 installation. No changes were made during installation, except installation path, which has no spaces in it. I have no third part modules installed which could interfer. I have also a Python 2.7 installed but it is not on my path.
Nils-Hero commentedon Jun 6, 2017
I just found out that the example works in idle and if i do in a console:
python server.py
but not if i do just:
server.py
What is the secret behind this?
bitdancer commentedon Jun 6, 2017
If you just type 'server.py' it will use whichever interpreter is associated with .py files, which might not be python3. You may want to learn about the 'py' helper command.
Nils-Hero commentedon Jun 6, 2017
What would that be? If i google 'py helper command' i get no good results.
bitdancer commentedon Jun 6, 2017
It gets installed along with python3, I believe. If you google for 'python py' you should see the pypi package version in the top hits.
Nils-Hero commentedon Jun 6, 2017
I am not sure if the py package i found on PyPi is what you meant, but if you mean the py launcher (the py.exe in the windows dir), yes, i have that.
My system was indeed misconfigured as you correctly guessed, i had the .py filetype pointing to a Python version 3.5. I have now uninstalled everything, manually cleaned up the registry, reinstalled Python 3.6 and now everything works. Sorry, my mistake.
Nils-Hero commentedon Jun 6, 2017
ok