refactor: Conditionally import tkinter and update local environment detection
This commit is contained in:
parent
c224424e04
commit
cc3a7d1175
@ -5,13 +5,19 @@ import warnings
|
||||
import shutil
|
||||
from io import BytesIO
|
||||
import tempfile
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
import glob
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
# Conditionally import tkinter
|
||||
try:
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog
|
||||
TKINTER_AVAILABLE = True
|
||||
except ImportError:
|
||||
TKINTER_AVAILABLE = False
|
||||
from main import (
|
||||
load_workbook_with_possible_passwords,
|
||||
copy_excel_file,
|
||||
@ -21,11 +27,7 @@ from main import (
|
||||
|
||||
def is_running_locally():
|
||||
"""Check if the app is running locally or in cloud environment"""
|
||||
try:
|
||||
import tkinter
|
||||
return True
|
||||
except ImportError:
|
||||
return False
|
||||
return TKINTER_AVAILABLE
|
||||
|
||||
# Configure page
|
||||
st.set_page_config(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user