nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
84.71k stars 3.43k forks source link

I get a error when i run fuck command in windows, installed fuck with pip #1460

Open arsalanmohseni opened 2 weeks ago

arsalanmohseni commented 2 weeks ago

The output of thefuck --version (something like The Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release):

Traceback (most recent call last):

File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\mardin it\AppData\Local\Programs\Python\Python312\Scripts\thefuck.exe__main__.py", line 4, in File "C:\Users\mardin it\AppData\Local\Programs\Python\Python312\Lib\site-packages\thefuck\entrypoints\main.py", line 8, in from .. import logs # noqa: E402 ^^^^^^^^^^^^^^^^^^^ File "C:\Users\mardin it\AppData\Local\Programs\Python\Python312\Lib\site-packages\thefuck\logs.py", line 8, in from .conf import settings File "C:\Users\mardin it\AppData\Local\Programs\Python\Python312\Lib\site-packages\thefuck\conf.py", line 1, in from imp import load_source ModuleNotFoundError: No module named 'imp'

Your system (Debian 7, ArchLinux, Windows, etc.):

Windows 11

How to reproduce the bug:

No idea

The output of The Fuck with THEFUCK_DEBUG=true exported (typically execute export THEFUCK_DEBUG=true in your shell before The Fuck):

   Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\mardin it\AppData\Local\Programs\Python\Python312\Scripts\thefuck.exe\__main__.py", line 4, in <module>
  File "C:\Users\mardin it\AppData\Local\Programs\Python\Python312\Lib\site-packages\thefuck\entrypoints\main.py", line 8, in <module>
    from .. import logs  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mardin it\AppData\Local\Programs\Python\Python312\Lib\site-packages\thefuck\logs.py", line 8, in <module>
    from .conf import settings
  File "C:\Users\mardin it\AppData\Local\Programs\Python\Python312\Lib\site-packages\thefuck\conf.py", line 1, in <module>
    from imp import load_source
ModuleNotFoundError: No module named 'imp'

If the bug only appears with a specific application, the output of that application and its version:

Its doesn't work anywhere
FlamingPhoenix40 commented 2 weeks ago

Ran into the same issue today myself. I assume you are running Python 3.12? From what I can tell from here on Stackoverflow, imp is deprecated and removed in 3.12. thefuck would need to be updated to remove that dependency. As an intermediate solution you could switch to Python 3.11 until thefuck gets fixed, if you don't specifically need Python 3.12.

FidelSch commented 2 weeks ago

There is a solution on #1449 , for Linux at least Worked for me on Ubuntu 24 If I were you I'd try to find the equivalent file on Windows

arsalanmohseni commented 2 weeks ago

Ran into the same issue today myself. I assume you are running Python 3.12? From what I can tell from here on Stackoverflow, imp is deprecated and removed in 3.12. thefuck would need to be updated to remove that dependency. As an intermediate solution you could switch to Python 3.11 until thefuck gets fixed, if you don't specifically need Python 3.12.

I have python 3.12 and i need it too