metachris / py2app

Fork of the original py2app from https://bitbucket.org/ronaldoussoren/py2app
https://pythonhosted.org/py2app/
Other
75 stars 17 forks source link

Unmodified environment for subprocesses #4

Open ghost opened 6 years ago

ghost commented 6 years ago

I wanted to ask this on the mailing list, subscribed and everything, but the mails do not go through:

I’m working on a frontend to Borg backup. 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']

But of course this also will fail on system where the variables are set in the default environment. My question then is, is there a clean way to restore the original environment, before py2app changed it?