Giter Site home page Giter Site logo

Comments (4)

Theblackcat98 avatar Theblackcat98 commented on July 4, 2024

+1 On this error.
Getting the same exact error output on my windows install.

(Although it seems this issue is not System-Specific I'll fill out an issue template aswell.)


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

File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Python312\Scripts\thefuck.exe_main
.py", line 4, in
File "C:\Python312\Lib\site-packages\thefuck\entrypoints\main.py", line 8, in
from .. import logs # noqa: E402
^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\thefuck\logs.py", line 8, in
from .conf import settings
File "C:\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, using Powershell

  • How to reproduce the bug:

pip install thefuck

fuck

  • The error msg:

Same as above

from thefuck.

Theblackcat98 avatar Theblackcat98 commented on July 4, 2024

Fixed this issue, caused my deprecated package "imp" in Python 12
Check 904693a

from thefuck.

webbertakken avatar webbertakken commented on July 4, 2024

Still getting the same issue on thefuck 3.32 and PowerShell 7.4.1.

image

Looking at mentioned commit, the page gives a warning

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Comparing it to the current main branch, it looks like imp is still in place (red is main, green is suggested fix).

from six import text_type
from . import const
from .system import Path

+ import importlib.util
+ import importlib.machinery
+ 
+ 
+ def load_source(modname, filename):
+     loader = importlib.machinery.SourceFileLoader(modname, filename)
+     spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
+     module = importlib.util.module_from_spec(spec)
+     # The module is always executed and not cached in sys.modules.
+     # Uncomment the following line to cache the module.
+     # sys.modules[module.__name__] = module
+     loader.exec_module(module)
+     return module
- try:
-     import importlib.util
- 
-     def load_source(name, pathname, _file=None):
-         module_spec = importlib.util.spec_from_file_location(name, pathname)
-         module = importlib.util.module_from_spec(module_spec)
-         module_spec.loader.exec_module(module)
-         return module
- except ImportError:
-     from imp import load_source

@Theblackcat98 did you suggest this change in a PR that you could reference?

Did the fix magically disappear? :)

from thefuck.

webbertakken avatar webbertakken commented on July 4, 2024

related: #1434

from thefuck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.