Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sys.executable to launch python scripts #420

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,17 @@ def on_theme_change(self, e=None):
self.load_theme_preview()

def on_theme_editor_click(self):
subprocess.Popen(os.path.join(os.getcwd(), "theme-editor.py") + " \"" + self.theme_cb.get() + "\"", shell=True)
subprocess.Popen([sys.executable, os.path.join(os.getcwd(), "theme-editor.py"), self.theme_cb.get()])

def on_save_click(self):
self.save_config_values()

def on_saverun_click(self):
self.save_config_values()
subprocess.Popen(os.path.join(os.getcwd(), "main.py"), shell=True)
kwargs = {}
if hasattr(subprocess, "DETACHED_PROCESS"):
kwargs["creationflags"] = subprocess.DETACHED_PROCESS
subprocess.Popen([sys.executable, os.path.join(os.getcwd(), "main.py")], **kwargs)
self.window.destroy()

def on_brightness_change(self, e=None):
Expand Down
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ def on_signal_caught(signum, frame=None):

def on_configure_tray(tray_icon, item):
logger.info("Configure from tray icon")
subprocess.Popen(os.path.join(os.getcwd(), "configure.py"), shell=True)
kwargs = {}
if hasattr(subprocess, "DETACHED_PROCESS"):
kwargs["creationflags"] = subprocess.DETACHED_PROCESS
subprocess.Popen([sys.executable, os.path.join(os.getcwd(), "configure.py")], **kwargs)
clean_stop(tray_icon)


Expand Down