[PyQt] Shutil.which return None after app bundled with fsb - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [PyQt] Shutil.which return None after app bundled with fsb (/thread-28601.html) |
Shutil.which return None after app bundled with fsb - yok0 - Jul-25-2020 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 RE: Shutil.which return None after app bundled with fsb - yok0 - Jul-26-2020 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 RE: Shutil.which return None after app bundled with fsb - deanhystad - Jul-26-2020 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. RE: Shutil.which return None after app bundled with fsb - yok0 - Jul-27-2020 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? |