aegirhall / console-menu

A simple Python menu system for building terminal user interfaces.
MIT License
365 stars 58 forks source link

by calling os.path.isdir() in a FunctionItem it jumps to the previous menu without finishing the function. #50

Open hadi-nayebi opened 4 years ago

hadi-nayebi commented 4 years ago

I have a FunctionItem like: root_path = FunctionItem("Set a path for the root directory: ", set_root_path, [None, False], menu=new_profile_menu) new_profile_menu.append_item(root_path)

the set_root_path function contain a line:

if not path.isdir(root) or force: mkdir(root) mkdir(root+'profile')

which makes the menu jump to the previous one without finishing the function call. if I remove the line it works. even if I only have

print(path.isdir(root))

same happens.

Drezbek commented 4 years ago

maybe you can workaround this with https://docs.python.org/3/library/pathlib.html??

image