diff --git a/openslides/main.py b/openslides/main.py index e4cd32b61..0d609b641 100644 --- a/openslides/main.py +++ b/openslides/main.py @@ -349,6 +349,14 @@ def get_user_data_path(*args): def is_portable(): + """Return True if openslides is run as portable version""" + + # NOTE: sys.executable is the path of the *interpreter* + # the portable version embeds python so it *is* the interpreter. + # The wrappers generated by pip and co. will spawn + # the usual python(w).exe, so there is no danger of mistaking + # them for the portable even though they may also be called + # openslides.exe exename = os.path.basename(sys.executable).lower() return exename == "openslides.exe"