Closed PyzMenPL closed 1 year ago
Hey and thanks for using my library. Menu entries can contain some special characters to encode additional information into a menu entry and the routine you are referencing extracts these meta information. Probably your menu entries contain at least one of these special characters but not in a format which simple-term-menu would expect. The possibilities:
[
. A letter enclosed in [ ]
brackets at the beginning of an entry is reserved for shortcut keys. If an entry starts with [
but there is no closing ]
, this could lead to an error.|
to add additional data which is not shown in the menu but can be used in the preview window. Escaped bars \|
are ignored.Does this already help? Do your menu entries contain brackets or bars?
I worked it out š
When I tried to test whether the user could create an empty file, I didn't implement anything to prevent them from doing so, just a simple print("You can't create file without name!")
, I was sure that you couldn't just create a file with .
at the beginning of its name. And contrary to my assumption, the file was created .json
. Every time I get a list of files, the program removes the .json
from them and adds [
]
before and after the folder name. I didn't have skip_empty_entries=True
and what happened was that I got the .json
file replaced with ''
and that turned out to be the source of my problem. The situation is funny because files that start with .
are hidden and I had no idea this file was even created š
Sorry for bothering you and thanks for your reply š
Hi, I am currently making a learning program. I was in the process of modifying my module responsible for saving files, when I finished this I wanted to check if the prevention of creating files without a name was working as expected, so using my program I tried to create a '.json' file. The program crashed and threw up some weird error that starts in a completely different part of my code and ends up in the simple-term-menu library code. I run the code again to see if it works at least to prevent the creation of 2 of the same file and it turns out I can't do anything, because my main menu isn't working. The program throws the same error as before, only now on startup. This is what the error looks like:
Traceback (most recent call last): File "main.py", line 284, in
menu.showMenu()
File "main.py", line 71, in showMenu
menuMain = TerminalMenu(fullList, cursor_index=cursorIndex)
File "/.local/lib/python3.10/site-packages/simple_term_menu.py", line 667, in init
) = extract_shortcuts_menu_entries_and_preview_arguments(menu_entries)
File "/.local/lib/python3.10/site-packages/simple_term_menu.py", line 604, in extract_shortcuts_menu_entries_and_preview_arguments
assert match_obj is not None
AssertionError
What might be the problem here?