typer-cli icon indicating copy to clipboard operation
typer-cli copied to clipboard

AttributeError: 'zipimport.zipimporter' object has no attribute 'exec_module'

Open cbdmaul opened this issue 5 years ago • 4 comments

Get this error trying to run module. Seems to happen no matter what. Maybe changes since Python>3.5 based on this project's error? https://gitlab.kitware.com/vtk/vtk/-/merge_requests/6177

$ typer name_of_my_module run Traceback (most recent call last): File "/usr/local/bin/typer", line 8, in sys.exit(main()) File "/usr/local/lib/python3.6/dist-packages/typer_cli/main.py", line 306, in main return app() File "/usr/local/lib/python3.6/dist-packages/typer/main.py", line 214, in call return get_command(self)(*args, **kwargs) File "/home/h/.local/lib/python3.6/site-packages/click/core.py", line 829, in call return self.main(*args, **kwargs) File "/home/h/.local/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.6/dist-packages/typer_cli/main.py", line 66, in invoke self.maybe_add_run(ctx) File "/usr/local/lib/python3.6/dist-packages/typer_cli/main.py", line 71, in maybe_add_run maybe_add_run_to_cli(self) File "/usr/local/lib/python3.6/dist-packages/typer_cli/main.py", line 144, in maybe_add_run_to_cli obj = get_typer_from_state() File "/usr/local/lib/python3.6/dist-packages/typer_cli/main.py", line 136, in get_typer_from_state spec.loader.exec_module(module) # type: ignore AttributeError: 'zipimport.zipimporter' object has no attribute 'exec_module'

Versions:

Python 3.6.9 (default, Jul 17 2020, 12:50:27) [GCC 8.4.0] on linux

Requirement already up-to-date: typer in /usr/local/lib/python3.6/dist-packages (0.3.2) Requirement already satisfied, skipping upgrade: click<7.2.0,>=7.1.1 in /home/h/.local/lib/python3.6/site-packages (from typer) (7.1.2)

Collecting typer-cli Downloading typer_cli-0.0.11-py3-none-any.whl (8.9 kB) Requirement already satisfied, skipping upgrade: colorama<0.5.0,>=0.4.3 in /usr/local/lib/python3.6/dist-packages (from typer-cli) (0.4.3) Requirement already satisfied, skipping upgrade: shellingham<2.0.0,>=1.3.2 in /usr/local/lib/python3.6/dist-packages (from typer-cli) (1.3.2) Requirement already satisfied, skipping upgrade: importlib_metadata<3.0,>=1.5 in /usr/local/lib/python3.6/dist-packages (from typer-cli) (1.7.0) Requirement already satisfied, skipping upgrade: typer<0.4.0,>=0.3.0 in /usr/local/lib/python3.6/dist-packages (from typer-cli) (0.3.2) Requirement already satisfied, skipping upgrade: zipp>=0.5 in /home/h/.local/lib/python3.6/site-packages (from importlib_metadata<3.0,>=1.5->typer-cli) (0.5.2) Requirement already satisfied, skipping upgrade: click<7.2.0,>=7.1.1 in /home/h/.local/lib/python3.6/site-packages (from typer<0.4.0,>=0.3.0->typer-cli) (7.1.2) Installing collected packages: typer-cli Attempting uninstall: typer-cli Found existing installation: typer-cli 0.0.10 Uninstalling typer-cli-0.0.10: Successfully uninstalled typer-cli-0.0.10 Successfully installed typer-cli-0.0.11

cbdmaul avatar Oct 14 '20 15:10 cbdmaul

Also facing this issue.

LVSant avatar Mar 16 '22 13:03 LVSant

I'm using pipenv. To fix this, I just did pipenv --rm and reinstalled everything again, including typer-cli and it worked.

LVSant avatar Mar 16 '22 13:03 LVSant

I think this issue has been fixed in the python standard library: https://bugs.python.org/issue42131

cdcadman avatar Jul 28 '22 05:07 cdcadman

You can reduce the version of the package "Markdown". I also meet this problem, then I uninstall "Markdown" which is 3.5 and reinstall a new one which is 3.1.

M1aoLiu avatar Oct 07 '23 07:10 M1aoLiu