Open
Description
after rednotebook reads all the day files, and when it is trying to sort categories, it raises an error.
After some investigation I found out that the error is related to locale.strxfrm
in line 516 in journal.py
:
@property
def categories(self):
return sorted(
set(itertools.chain.from_iterable(day.categories for day in self.days)),
key=locale.strxfrm,
)
What I think is happening is that locale.strxfrm does not accept characters that are incompatible with the locale.
For example, my locale is en.US.UTF-8. For example: locale.strxfrm("عربي") will raise an error
Traceback (most recent call last):
File "/Users/ouss/Documents/workspace/rednotebook/rednotebook/journal.py", line 624, in <module>
main()
File "/Users/ouss/Documents/workspace/rednotebook/rednotebook/journal.py", line 606, in main
journal = Journal()
File "/Users/ouss/Documents/workspace/rednotebook/rednotebook/journal.py", line 238, in __init__
self.open_journal(journal_path)
File "/Users/ouss/Documents/workspace/rednotebook/rednotebook/journal.py", line 401, in open_journal
self.frame.categories_tree_view.categories = self.categories
File "/Users/ouss/Documents/workspace/rednotebook/rednotebook/journal.py", line 514, in categories
return sorted(
OSError: [Errno 22] Invalid argument
What I wish to happen, is that categories are sorted regardless of the characters type or locale.