Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache build error #160

Open
evcastelani opened this issue Dec 5, 2022 · 0 comments
Open

Cache build error #160

evcastelani opened this issue Dec 5, 2022 · 0 comments

Comments

@evcastelani
Copy link

When I rebuilt the cache, this error occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/dmenu_extended/main.py", line 775, in cache_save
    f.write(item + "\n")
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcf3' in position 58: surrogates not allowed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/dmenu_extended_cache_build", line 8, in <module>
    sys.exit(build_cache())
  File "/usr/local/lib/python3.10/dist-packages/dmenu_extended/main.py", line 2270, in build_cache
    d.build_cache()
  File "/usr/local/lib/python3.10/dist-packages/dmenu_extended/main.py", line 1237, in build_cache
    self.cache_save(filenames, file_cache_files)
  File "/usr/local/lib/python3.10/dist-packages/dmenu_extended/main.py", line 805, in cache_save
    f.write(item + "\n")
TypeError: a bytes-like object is required, not 'str'

I've seen that bugs of this type have been fixed over time, but I don't know how to fix this one. Any suggestion? I've been using version 1.2.1

marczuo pushed a commit to marczuo/dmenu-extended that referenced this issue May 7, 2024
When build_cache() encounters a UnicodeEncodeError, the original code
did not escape unprintable chars and caused the cache build to fail.
This patch fixes the code so that the culprit is correctly printed in
debug mode.
MarkHedleyJones pushed a commit that referenced this issue Jun 3, 2024
* Fix UnicodeEncodeError exception handling (#160)

When build_cache() encounters a UnicodeEncodeError, the original code
did not escape unprintable chars and caused the cache build to fail.
This patch fixes the code so that the culprit is correctly printed in
debug mode.

* Incrementing version string (1.2.1 -> 1.2.2)

* Reformatted code using pyblack

---------

Co-authored-by: Marc Zuo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant