> On 21 Jan 2018, at 01:48, Tuomo Valkonen <tuo...@iki.fi> wrote: > > I’m working on a frontend to Borg backup, based on rumps > (http://rumps.readthedocs.io/en/latest/ > <http://rumps.readthedocs.io/en/latest/>). For using the keychain, etc., it > would be useful to turn the frontend into a standalone app. So I tried to do > that with py2app, but when running my app this way, borg subprocesses fail: > module ‘borg’ not found. If I pass a modified environment to > subprocess.Popen, as follow, then things will work: > > env=os.environ.copy() > del env['PYTHONPATH'] > del env['PYTHONHOME']
That is what I do. There might be more env to remove, depends on the details of you app code. > > But of course this also will fail on system where the variables are set in > the default environment. I would not expect them in the default env. Only in the env setup by .bash_profile that you do not see in an App I recall. > My question then is, is there a clean way to restore the original > environment, before py2app changed it? If you want to find out the details of the env you start with edit your Appto move its executable (named Info.plist) to one side and put a bash script in its place that records the command line and env into a file for you to look at. Then call you renamed executable as the last thing from the script. Your exe is in <YourApp>.app/Contents/MacOS/<YourApp>. Barry > > Tuomo > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > https://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org https://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG