Unmodified environment for subprocesses

Tuomo Valkonen <[email protected]> Sun, 21 Jan 2018 01:48:03 +0000
Newsgroups gmane.comp.python.apple
Message-ID <[email protected]>
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']

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?

Tuomo

_______________________________________________
Pythonmac-SIG maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG