PYQT5 QThread: Destroyed while thread is still running
-
EDIT : soooo Stupid...
@SGaist when you asked what I was calling it gave me an idea. I changed my command with an os based one like "ls -l" and it worked. I thought it was the same with my cli app I was calling. So i just threw it like QProcess.start("someapp arg").
To make it work I just had to specify the absolute path like QProcess.start("/usr/local/bin/someapp arg").Sorry for that and @SGaist thanks for your assistance!
-
Rather than hard coding such a path, you might want to consider modifying the PATH environment variable using QProcessEnvironment so that you don't rely on where it could be exactly and also provide the option for your users to change the path where that application can be found.
-
Rather than hard coding such a path, you might want to consider modifying the PATH environment variable using QProcessEnvironment so that you don't rely on where it could be exactly and also provide the option for your users to change the path where that application can be found.
@SGaist sure QProcessEnvironment is a better way.
Also, I thought I could find the path programmatically like using shutil.which("app") but when the program is bundled and launched from the myApp.app. shutil.which() can't find program in /usr/local... it only find os based executable like ls. -
How are you bundling it ?
Is it a compiled executable ? -
I meant the application you execute with QProcess.
-
Oh it's youtube-dl and it's work fine like I said if I specify the absolute path of the executable in this case it's /usr/local/bin/...
Sorry it's not related to QProcess but in some situations youtube-dl needs ffmpeg so I would check if it's installed on the system. That's why I use shutil.which('ffmpeg').
It works great in my virtualenv but after compiled the program, shutil can't find the path of ffmpeg. Somehow it can't find apps in /usr/local/bin even if it is in $PATH. However it will find os based app like "ls", "mkdir"... -
Oh it's youtube-dl and it's work fine like I said if I specify the absolute path of the executable in this case it's /usr/local/bin/...
Sorry it's not related to QProcess but in some situations youtube-dl needs ffmpeg so I would check if it's installed on the system. That's why I use shutil.which('ffmpeg').
It works great in my virtualenv but after compiled the program, shutil can't find the path of ffmpeg. Somehow it can't find apps in /usr/local/bin even if it is in $PATH. However it will find os based app like "ls", "mkdir"... -
@Yok0
Are you certain/usr/local/bin
is on your PATH, really? Things likels
/mkdir
are in/bin
and/or/usr/bin
, which will be on$PATH
, maybe/usr/local/bin
is not.@JonB Yep! I did checked it.
In my app I tried to displayed my $PATH with os.environ.get('PATH'). When I run it in my virtualenv, it shows me to correct $PATH with /usr/bin, /usr/bin/local/, .cargo/bin so on and so forth BUT after bundling the project in an executable, that same command only returns /usr/bin:/bin:/usr/sbin:/sbin
The weird thing is that the app is run by the same user in venv and as a executable. The $PATH is somehow overridden. -
@JonB Yep! I did checked it.
In my app I tried to displayed my $PATH with os.environ.get('PATH'). When I run it in my virtualenv, it shows me to correct $PATH with /usr/bin, /usr/bin/local/, .cargo/bin so on and so forth BUT after bundling the project in an executable, that same command only returns /usr/bin:/bin:/usr/sbin:/sbin
The weird thing is that the app is run by the same user in venv and as a executable. The $PATH is somehow overridden. -
@Yok0
Yes, virtualenv's job is to set your path. It is not surprising it is different from path outside venv.So your problem is that the executable you wish to run lives in a directory which is not on your usual path.
-
@JonB mhm indeed the working direcory of the executable become /
instead of /Users/foo .. obvious, thanks.