thefuck icon indicating copy to clipboard operation
thefuck copied to clipboard

sqlite3.OperationalError: unable to open database file

Open wojciechGaudnik opened this issue 3 years ago • 1 comments

Hi,

The Fuck 3.29 using Python 3.9.7 and ZSH 5.8

Traceback (most recent call last): File "/usr/bin/thefuck", line 13, in 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 41, in fix_command corrected_commands = get_corrected_commands(command) File "/usr/share/thefuck/thefuck/corrector.py", line 89, in get_corrected_commands corrected for rule in get_rules() File "/usr/share/thefuck/thefuck/corrector.py", line 48, in get_rules return sorted(get_loaded_rules(paths), File "/usr/share/thefuck/thefuck/corrector.py", line 17, in get_loaded_rules rule = Rule.from_path(path) File "/usr/share/thefuck/thefuck/types.py", line 140, in from_path rule_module = load_source(name, str(path)) File "/usr/lib/python3.9/imp.py", line 171, in load_source module = _load(spec) File "", line 711, in _load File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/usr/share/thefuck/thefuck/rules/apt_get.py", line 13, in _get_packages = CommandNotFound.CommandNotFound().get_packages File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 79, in init self.db = SqliteDatabase(dbpath) File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 12, in init self.con = sqlite3.connect(filename) sqlite3.OperationalError: unable to open database file

Did I miss something or is there a bug? I tried with apt and new version from pip. The same story.

This issue is only on a normal user account, on root there isn't a problem.

wojciechGaudnik avatar Nov 11 '21 15:11 wojciechGaudnik

Correct me if I'm wrong, but I don't think this is a bug in thefuck. It seems to be a known bug in CommandNotFound instead: https://bugs.launchpad.net/command-not-found/+bug/1824000

A temporary workaround is to fix the db file permissions manually:

sudo chmod ugo+r /var/lib/command-not-found/commands.db*

nootr avatar Nov 18 '21 18:11 nootr

With no participation since nearly 2 years, and good directions to go further, maybe this issue can be closed ?

Rom1deTroyes avatar Nov 03 '23 15:11 Rom1deTroyes