mathoudebine / turing-smart-screen-python

Unofficial Python system monitor and library for small IPS USB-C displays like Turing Smart Screen or XuanFang
GNU General Public License v3.0
1.05k stars 174 forks source link

Use sys.executable to launch python scripts #420

Open take-cheeze opened 8 months ago

take-cheeze commented 8 months ago

So that scripts like main.py is launched by same python executable used by configure.py

mathoudebine commented 8 months ago

Hello @take-cheeze and thanks for the PR, were you able to test it on Linux and Windows?

take-cheeze commented 8 months ago

I've tested in macOS. Maybe windows may have some trouble so I'll test it

take-cheeze commented 8 months ago

Seems creationflags=subprocess.DETACHED_PROCESS is required to open configure.py and main.py because with normal Popen process will be also closed with the parent process. Though this feature is only for windows...

mathoudebine commented 8 months ago

I tested your new changes on Windows, but now when I click on "Save and run" from the configuration window it starts the main.py script in a new terminal window, whereas previously it started the script in background. Same thing when main.py is running on a tray icon right click > "Configure" it starts configure.py in a terminal, not in background. Do you see the same behavior on your machine?

take-cheeze commented 8 months ago

I'm running it from Terminal app so it seems to be the difference