Skip to content

AttributeError: module 'tempfile' has no attribute '_TemporaryFileWrapper' #6018

@Sengolda

Description

@Sengolda

Describe the bug

Ok so i only had this line of code import aiohttp

But i get this error

Traceback (most recent call last):
  File "/Users/senushka/Documents/learning/test.py", line 1, in <module>
    import aiohttp
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import (
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/client.py", line 35, in <module>
    from . import hdrs, http, payload
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/http.py", line 7, in <module>
    from .http_parser import (
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/http_parser.py", line 15, in <module>
    from .helpers import NO_EXTENSIONS, BaseTimerContext
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/helpers.py", line 43, in <module>
    from urllib.request import getproxies
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 102, in <module>
    from urllib.error import URLError, HTTPError, ContentTooShortError
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/error.py", line 14, in <module>
    import urllib.response
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/response.py", line 14, in <module>
    class addbase(tempfile._TemporaryFileWrapper):
AttributeError: module 'tempfile' has no attribute '_TemporaryFileWrapper'

To Reproduce

import aiohttp
# I'm assuming this isn't a problem with the lib as it worked in my shell when I just typed `python3` then ran `import aiohttp`

Expected behavior

I would have just expected the module to import.

Logs/tracebacks

Traceback:


Traceback (most recent call last):
  File "/Users/senushka/Documents/learning/test.py", line 1, in <module>
    import aiohttp
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import (
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/client.py", line 35, in <module>
    from . import hdrs, http, payload
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/http.py", line 7, in <module>
    from .http_parser import (
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/http_parser.py", line 15, in <module>
    from .helpers import NO_EXTENSIONS, BaseTimerContext
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/helpers.py", line 43, in <module>
    from urllib.request import getproxies
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 102, in <module>
    from urllib.error import URLError, HTTPError, ContentTooShortError
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/error.py", line 14, in <module>
    import urllib.response
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/response.py", line 14, in <module>
    class addbase(tempfile._TemporaryFileWrapper):
AttributeError: module 'tempfile' has no attribute '_TemporaryFileWrapper'


### Python Version

```console
3.9.4

aiohttp Version

3.7.4.post0

multidict Version

4.7.6

yarl Version

1.5.1

OS

MacOS

Related component

Client

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions