Code Monkey home page Code Monkey logo

Comments (17)

Darkextratoasty avatar Darkextratoasty commented on July 28, 2024 12

quick fix for pip installed version at least:

open ~/.local/lib/python3.12/site-packages/thefuck/conf.py
replace line;

from imp import load_source

with;

import importlib.machinery

and lines;

settings = load_source(
    'settings', text_type(self.user_dir.joinpath('settings.py')))

with;

settings = importlib.machinery.SourceFileLoader('settings', text_type(self.user_dir.joinpath('settings.py'))).load_module()

then open ~/.local/lib/python3.12/site-packages/thefuck/types.py
replace import statement as above;

from imp import load_source

with;

import importlib.machinery

and line;

rule_module = load_source(name, str(path))

with;

rule_module = importlib.machinery.SourceFileLoader(name, str(path)).load_module()

This worked for me on Fedora 40 using fish shell in tilix terminal emulator, can't say for any other combination.

from thefuck.

lloydbayley avatar lloydbayley commented on July 28, 2024 4

Found in a #1434

pip uninstall thefuck
pip install https://github.com/nvbn/thefuck/archive/master.zip

from thefuck.

For-Elyisa avatar For-Elyisa commented on July 28, 2024 2

It seems thefuck can`t work on python 3.12. The last release was build in 2022. May need someone update it.

from thefuck.

danielbmeireles avatar danielbmeireles commented on July 28, 2024 1

The workaround proposed by @Darkextratoasty worked on my machine:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04 LTS"

from thefuck.

george-gca avatar george-gca commented on July 28, 2024 1

It is just sad when a great OSS is left abandoned. Maybe it is time for someone to create a fork with proper updates (there are more than 80 PRs in this repo!!).

from thefuck.

unikitty37 avatar unikitty37 commented on July 28, 2024 1

If you're not a Python dev who already has a virtualenv setup, you'll need to add one as per these instructions:

python3 -m venv ~/.local --system-site-packages

and make sure ~/.local/bin is in $PATH.

Really wish Python stuff was easier to use without all these gymnastics 😁

from thefuck.

antgel avatar antgel commented on July 28, 2024 1

I found this topic on Stack Overflow: it seems should be importlib instead of imp with Python 3.12.

As mentioned ^^^:
#1449 (comment)

from thefuck.

flyingmongoose avatar flyingmongoose commented on July 28, 2024

The apt package doesn't work
Using pip just gives struggles
But Snap did the trick.

https://snapcraft.io/install/thefuck/ubuntu#install

It's not the most recent version but it's still useful

from thefuck.

lloydbayley avatar lloydbayley commented on July 28, 2024

If you're doing it in dev for testing, then you could always use the pip argument of --break-system-packages but it's not recommended for production environments. I have absolutely NOT done that on my live systems without any problems so-far! 😝

from thefuck.

antgel avatar antgel commented on July 28, 2024

@Darkextratoasty A .patch file would have been nice, but I can't complain, for what I paid I'm very happy. Thank you so much!

from thefuck.

Sandman6z avatar Sandman6z commented on July 28, 2024

I also met this problem under my
Linux Sandman-PC 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux.
And I found that maybe the python-dev package was already stop support any more. However, use python3-dev or python-dev-is-python3 from the prompt need to change the code.

from thefuck.

mhalano avatar mhalano commented on July 28, 2024

I found this topic on Stack Overflow: it seems should be importlib instead of imp with Python 3.12.

from thefuck.

Kol9yN avatar Kol9yN commented on July 28, 2024

quick fix for pip installed version at least:

open ~/.local/lib/python3.12/site-packages/thefuck/conf.py replace line;

from imp import load_source

with;

import importlib.machinery

and lines;

settings = load_source(
    'settings', text_type(self.user_dir.joinpath('settings.py')))

with;

settings = importlib.machinery.SourceFileLoader('settings', text_type(self.user_dir.joinpath('settings.py'))).load_module()

then open ~/.local/lib/python3.12/site-packages/thefuck/types.py replace import statement as above;

from imp import load_source

with;

import importlib.machinery

and line;

rule_module = load_source(name, str(path))

with;

rule_module = importlib.machinery.SourceFileLoader(name, str(path)).load_module()

This worked for me on Fedora 40 using fish shell in tilix terminal emulator, can't say for any other combination.

please can you make a pull request with this fix?

from thefuck.

Darkextratoasty avatar Darkextratoasty commented on July 28, 2024

please can you make a pull request with this fix?

No, because this is a hacky work-around and it's not clear if it has other, unwanted effects. If someone with more knowledge than myself and a decent set of unit tests can verify that it's a clean fix, then a pull request could be added. Also I know basically nothing of git, so I don't even know how to go about doing a pull request.

from thefuck.

Kol9yN avatar Kol9yN commented on July 28, 2024

@nvbn Коллега, пожалуйста, если есть возможность, исправьте установку под Убунту 22.04.
Уж больно много плясок с бубном приходиться делать что бы в ато режиме раскатать софт...
Благодарствую!

from thefuck.

krstp avatar krstp commented on July 28, 2024

The proposed workaround somewhat works on:

Distributor ID: Ubuntu
Description:    Ubuntu 24.04 LTS
Release:        24.04
Codename:       noble

but when invoking <command> | fuck it yields:

zsh: command not found: lla
ll [enter/↑/↓/ctrl+c]Traceback (most recent call last):
  File "/usr/bin/thefuck", line 13, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/share/thefuck/thefuck/entrypoints/main.py", line 26, in main
    fix_command(known_args)
  File "/usr/share/thefuck/thefuck/entrypoints/fix_command.py", line 42, in fix_command
    selected_command = select_command(corrected_commands)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/thefuck/thefuck/ui.py", line 83, in select_command
    for action in read_actions():
  File "/usr/share/thefuck/thefuck/ui.py", line 14, in read_actions
    key = get_key()
          ^^^^^^^^^
  File "/usr/share/thefuck/thefuck/system/unix.py", line 23, in get_key
    ch = getch()
         ^^^^^^^
  File "/usr/share/thefuck/thefuck/system/unix.py", line 14, in getch
    old = termios.tcgetattr(fd)
          ^^^^^^^^^^^^^^^^^^^^^
termios.error: (25, 'Inappropriate ioctl for device')

from thefuck.

george-gca avatar george-gca commented on July 28, 2024

Really wish Python stuff was easier to use without all these gymnastics 😁

@unikitty37 there is pipx. I applied the changes made in 0420442 and https://github.com/nvbn/thefuck/pull/1404/files to the pipx installed version, located in ~/.local/share/pipx/venvs/thefuck/lib/python3.12/site-packages/thefuck/.

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.