gnebbia / kb

A minimalist command line knowledge base manager
GNU General Public License v3.0
3.18k stars 104 forks source link

Cannot view/ open files #112

Closed Andonome closed 9 months ago

Andonome commented 1 year ago

Expected Behavior

kb view 0 should open the file.

Actual Behavior

Traceback (most recent call last):
  File "/usr/bin/kb", line 33, in <module>
    sys.exit(load_entry_point('kb-manager==0.1.7', 'console_scripts', 'kb')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/kb/main.py", line 66, in main
    dispatch(cmd, cmd_params, config=DEFAULT_CONFIG)
  File "/usr/lib/python3.11/site-packages/kb/main.py", line 56, in dispatch
    return COMMANDS[function](*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/kb/commands/view.py", line 68, in view
    view_by_id(args["nameid"], config, args["editor"], color_mode)
  File "/usr/lib/python3.11/site-packages/kb/commands/view.py", line 125, in view_by_id
    viewer.view(artifact_path, markers, color=color_mode)
  File "/usr/lib/python3.11/site-packages/kb/viewer.py", line 107, in view
    content = fname.read()
              ^^^^^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

Steps to Reproduce the Problem

  1. No idea.
  2. Something to do with Arch, probably.
  3. It happens with pdf and jpg files, and probably everything else.

Specifications

gnebbia commented 9 months ago

Can you be more specific? I am not able to reproduce the issue. Can you try cloning the project and try to run it with deps installed from a virtual environment?

Or what type of file is your file 0? That could give us hints about the source of the issue

Andonome commented 9 months ago

I'm afraid I've deleted the database and cannot replicate the issue.