Linux/thefuck: Difference between revisions
< Linux
Line 20: | Line 20: | ||
Having a hard time getting set up on Ubuntu 24.04 · Issue #1449 · nvbn/thefuck · GitHub | Having a hard time getting set up on Ubuntu 24.04 · Issue #1449 · nvbn/thefuck · GitHub | ||
https://github.com/nvbn/thefuck/issues/1449#issuecomment-2137634221 | https://github.com/nvbn/thefuck/issues/1449#issuecomment-2137634221 | ||
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. | |||
== clean version == | == clean version == |
Revision as of 05:05, 13 April 2025
thefuck
dead project, but very useful. See linux/pay-respects as an alternative.
Broken with newer python environments like Python 3.12 (which you would find on Ubuntu 24.04).
thefuck https://github.com/nvbn/thefuck
"Magnificent app which corrects your previous console command."
Installation
sudo apt update sudo apt install python3-dev python3-pip python3-setuptools pip3 install thefuck --user
fix for python 3.12
Having a hard time getting set up on Ubuntu 24.04 · Issue #1449 · nvbn/thefuck · GitHub https://github.com/nvbn/thefuck/issues/1449#issuecomment-2137634221
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.
clean version
Edit:
/usr/local/lib/python3.10/dist-packages/thefuck/ui.py try: selector = CommandSelector(corrected_commands) except NoRuleMatched: logs.failed('No fucks given' if get_alias() == 'fuck' else 'Nothing found')
to something like:
except NoRuleMatched: logs.failed('No ducks given' if get_alias() == 'fuck' else 'Nothing found')
eval "$(thefuck --alias)" alias fck=fuck alias oops=fuck alias nuts=fuck alias duck=fuck alias F=fuck