Python Forum
[PyQt] Shutil.which return None after app bundled with fsb
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Shutil.which return None after app bundled with fsb
#1
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
#2
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
Reply
#3
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.
Reply
#4
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?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020