Python Forum

Full Version: Shutil.which return None after app bundled with fsb
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm working on a small gui project based on pyQT5. The dev wen't fine until I bundled my app with fbs. In my code I have a shutil.which(someApp) which gets me the path of an executable. I do that because I don't want to hardcode the path and in case of the path changed in the future.
Thing is it work's great when I execute fsb run, shutil return /usr/local/bin/foo. However after my app gets "fsb freeze(d)" shutil seems to only find path for os based executable like ls.
If my executable is in /usr/local... it returns nothing.

Thanks for your help

Oups by FSB I meant FBS (fman build system)
sorry for this mistake
Reply to myself, shutil can't find the app because the $PATH variable change with the executable. The working directory isn't /Users/bar anymore
An easy test for this problem is move everything that will be frozen to a different directory, or better yet a different computer, and see if it still works. I intentionally use different folders for Python work on my home and work computer. When I package things up I test on both before distributing to others.
Yup, in macos it seems that with an .app executable even if it's get executed from /Users/foo/MyApp.app or /Applications/MyApp.app, and by a regular user (not root), the working dir become / and the $PATH does not reflect the one of the user and gets changed with /usr/bin:/bin:/usr/sbin:/sbin. Do you know why?