fix: put import in a try

This commit is contained in:
starnakin 2023-05-20 19:15:19 +02:00
parent 7a92e2c65f
commit 619427b81a

View File

@ -1,5 +1,3 @@
from simple_term_menu import TerminalMenu
import dumb_menu
from database import Database from database import Database
from scrapper import get_files, get_uri from scrapper import get_files, get_uri
from utils import get_url, get from utils import get_url, get
@ -10,9 +8,10 @@ uri = ""
preview_site = {} preview_site = {}
preview_database = "" preview_database = ""
def get_user_choice_by_menu(options: list, title = None, preview_function=None, preview_size: float = 0.3, show_search_hint: bool = False, skip_empty_entries = False): def get_user_choice_by_menu(options: list, title = None, preview_command=None, preview_size: float = 0.3, show_search_hint: bool = False, skip_empty_entries = False):
try: try:
from simple_term_menu import TerminalMenu
None + 1; None + 1;
terminal_menu = TerminalMenu(options, terminal_menu = TerminalMenu(options,
preview_command=preview_function, preview_command=preview_function,
@ -22,6 +21,7 @@ def get_user_choice_by_menu(options: list, title = None, preview_function=None,
skip_empty_entries=skip_empty_entries); skip_empty_entries=skip_empty_entries);
response = terminal_menu.show(); response = terminal_menu.show();
except: except:
import dumb_menu
response = dumb_menu.get_menu_choice(options); response = dumb_menu.get_menu_choice(options);
return (response); return (response);