Registry Mirror
Skip to content

WSGI examples raise AttributeError: __exit__ #74765

Closed

Description

@Nils-Hero
mannequin
BPO 30580
Nosy @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2017-06-06.22:45:18.526>
created_at = <Date 2017-06-06.12:34:54.910>
labels = ['invalid']
title = 'WSGI examples raise AttributeError: __exit__'
updated_at = <Date 2017-06-07.15:31:06.222>
user = 'https://bugs.python.org/Nils-Hero'

bugs.python.org fields:

activity = <Date 2017-06-07.15:31:06.222>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2017-06-06.22:45:18.526>
closer = 'Nils-Hero'
components = []
creation = <Date 2017-06-06.12:34:54.910>
creator = 'Nils-Hero'
dependencies = []
files = []
hgrepos = []
issue_num = 30580
keywords = []
message_count = 10.0
messages = ['295253', '295256', '295257', '295289', '295290', '295291', '295292', '295293', '295308', '295309']
nosy_count = 2.0
nosy_names = ['r.david.murray', 'Nils-Hero']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue30580'
versions = ['Python 3.6']

Activity

  1. Nils-Hero commented on Jun 6, 2017

    Nils-Heromannequin
    MannequinAuthor

    All examples on

    https://docs.python.org/3/library/wsgiref.html

    raise this exception:

    Traceback (most recent call last):
      File "C:\Code\test\server.py", line 110, in <module>
        with make_server('', 8000, simple_app) as httpd:
    AttributeError: __exit__

    Tested with

    Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32

  2. bitdancer commented on Jun 6, 2017

    @bitdancer
    Member

    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.

  3. bitdancer commented on Jun 6, 2017

    @bitdancer
    Member

    Either that or you aren't really running the make_server from wsgiref.simple_server.

  4. Nils-Hero commented on Jun 6, 2017

    Nils-Heromannequin
    MannequinAuthor

    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:

    from wsgiref.simple_server import make_server, demo_app
    with make_server('', 8000, demo_app) as httpd:
        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.

  5. Nils-Hero commented on Jun 6, 2017

    Nils-Heromannequin
    MannequinAuthor

    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?

  6. bitdancer commented on Jun 6, 2017

    @bitdancer
    Member

    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.

  7. Nils-Hero commented on Jun 6, 2017

    Nils-Heromannequin
    MannequinAuthor

    What would that be? If i google 'py helper command' i get no good results.

  8. bitdancer commented on Jun 6, 2017

    @bitdancer
    Member

    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.

  9. Nils-Hero commented on Jun 6, 2017

    Nils-Heromannequin
    MannequinAuthor

    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.

  10. Nils-Hero commented on Jun 6, 2017

    Nils-Heromannequin
    MannequinAuthor

    ok

  11. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions