question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Absolute paths with `--files` no longer supported in 6.0.0

See original GitHub issue

I typically run rofimoji in the following way:

data_dir=/usr/lib/python3.10/site-packages/picker/data

rofimoji --action clipboard -f "$data_dir"/{emojis.csv,latin-1_supplement.csv,general_punctuation.csv,math.csv}

which allows me to pick from the files already distributed with rofimoji. In 6.0.0, I get the following trace:

Traceback (most recent call last):
  File "/usr/bin/rofimoji", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.10/site-packages/picker/__main__.py", line 9, in main
    StandaloneRofimoji().standalone()
  File "/usr/lib/python3.10/site-packages/picker/standalone.py", line 25, in standalone
    action, value = self.__open_main_selector_window()
  File "/usr/lib/python3.10/site-packages/picker/standalone.py", line 46, in __open_main_selector_window
    read_characters_from_files(self.args.files, load_frecent_characters(), self.args.use_additional)
  File "/usr/lib/python3.10/site-packages/picker/file_loader.py", line 14, in read_characters_from_files
    for file in __resolve_all_filenames(files, use_additional):
  File "/usr/lib/python3.10/site-packages/picker/file_loader.py", line 26, in __resolve_all_filenames
    resolved_file_names += __resolve_filename(file_name, use_additional)
  File "/usr/lib/python3.10/site-packages/picker/file_loader.py", line 40, in __resolve_filename
    for file in (Path(__file__).parent / "data").glob(file_name if "*" in file_name else file_name + "*"):
  File "/usr/lib/python3.10/pathlib.py", line 1032, in glob
    raise NotImplementedError("Non-relative patterns are unsupported")
NotImplementedError: Non-relative patterns are unsupported

Which looks to me like a direct consequence of globbing on --files input with glob.

Is this intended? That’s technically one way of dealing with this: users should no longer use absolute paths with --files – which I’m fine with, would just like to see in the documentation how to address the files, as it isn’t obvious to me (data/emojis.csv with or without some combination of ../ didn’t work for me).

If not otherwise intended, perhaps it should do the trick to just not glob by default if no glob pattern is given by the user?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fdwcommented, Nov 3, 2022

I’ve added some lines to the manpage and the readme, and fixed the globbing bug 🙂

If it works for you now, I’ll close the issue.

1reaction
fdwcommented, Nov 2, 2022

You’ve found a really interesting scenario there 😉 Let me unpack: First, you use the packaged files, but with the absolute path (it should be fine to just call --files latin-1_supplement etc, without the path and the extension). Secondly, emojis.csv was split up for this release into, for example, emojis_smileys_emotion.csv. If you had called just emojis, it would still work thanks to some backwards-compatible globbing. And finally, there’s the actual bug where rofimoji tries to glob in a specific directory for a pattern with an absolute path - which doesn’t make any sense.

Together, they result in the error you see - you’re quite unlucky to find that, I have too say 😉

As a fix, I would recommend you don’t use the absolute path for packaged files anymore, and you can think about whether you want all emojis or not. One possible solution with all of them is --files emojis latin-1_supplement general_punctuation math 🙂

Also, I’ll have a look at the code and improve the error message. Finally, do you have a suggestion how to make it clearer in the readme that it’s possible to just use the file stem for --files?

Read more comments on GitHub >

github_iconTop Results From Across the Web

.NET Core 6 Found multiple publish output files with the same ...
The publish directories are all under each project so the "duplicate files" are never overwriting each other, the "relative" path is the same...
Read more >
Relative path to absolute path in C#? - Stack Overflow
The hrefs contain relative paths. Now, I need to extract the hrefs to the images and turn them into absolute paths in the...
Read more >
NETSDK1045: The current .NET SDK does not support 'newer ...
This error occurs when the build tools can't find the version of the .NET SDK that's needed to build a project. This is...
Read more >
tar@6.0.5 - Snyk Vulnerability Database
This logic is insufficient on Windows systems when extracting tar files that contain a path that is not an absolute path, but specify...
Read more >
Migrating to v6.0.0 - ESLint - Pluggable JavaScript Linter
Node.js 6 is no longer supported; eslint:recommended has been updated; Plugins and shareable ... RuleTester now requires an absolute path on parser option ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found