layday / instawow

World of Warcraft add-on manager CLI and GUI
GNU General Public License v3.0
163 stars 9 forks source link

Python3.8 get_args failure #52

Closed Rubio9 closed 4 years ago

Rubio9 commented 4 years ago

Getting the following error in the past two releases:

Traceback (most recent call last):
  File ".local/bin/instawow", line 5, in <module>
    from instawow.cli import main
  File ".local/lib/python3.8/site-packages/instawow/cli.py", line 33, in <module>
    from .resolvers import Defn, MultiPkgModel, Strategies
  File ".local/lib/python3.8/site-packages/instawow/resolvers.py", line 22, in <module>
    from typing_extensions import Literal, TypedDict, get_args
ImportError: cannot import name 'get_args' from 'typing_extensions' (.local/lib/python3.8/site-packages/typing_extensions.py)
Traceback (most recent call last):
  File ".local/bin/instawow", line 5, in <module>
    from instawow.cli import main
  File ".local/lib/python3.8/site-packages/instawow/cli.py", line 33, in <module>
    from .resolvers import Defn, MultiPkgModel, Strategies
  File ".local/lib/python3.8/site-packages/instawow/resolvers.py", line 22, in <module>
    from typing_extensions import Literal, TypedDict, get_args
ImportError: cannot import name 'get_args' from 'typing_extensions' (.local/lib/python3.8/site-packages/typing_extensions.py)

The error is here in resolvers.py:

 22 from typing_extensions import Literal, TypedDict, get_args

It looks like get_args (for Python 3.8+ anyway) is now in typing rather than typing_extensions. This fixes it for me:

 22 from typing_extensions import Literal, TypedDict
 23 from typing import get_args
layday commented 4 years ago

What version of typing_extensions do you have installed?

Rubio9 commented 4 years ago

Instawow's self-updater pulled in 3.7.4.1 apparently. .local/lib/python3.8/site-packages/typing_extensions-3.7.4.1.dist-info

from the updater run: Requirement already satisfied, skipping upgrade: typing-extensions~=3.7 in ./.local/lib/python3.8/site-packages (from instawow) (3.7.4.1)

layday commented 4 years ago

typing-extensions is underspecified in our setup.py - you need version 3.7.4.2 or higher. I assume you're using pip (instawow does not come with its own updater). To update to the latest version of typing-extensions, use: python -m pip install -U typing-extensions.

Rubio9 commented 4 years ago

Ah. I see I magicked up a wrapper script and forgot about it. Yes, it's using pip3 to manage updates. After updating typing-extensions to 3.7.4.3 the error is gone. Thank you! Consider this a request to better specify the versioning requirement for typing-extensions :)

layday commented 4 years ago

The main branch no longer makes use of get_args but I should pay closer attention to dependency specification. Thank you for the report.