[Pythonmac-SIG] Unmodified environment for subprocesses

Tuomo Valkonen tuomov at iki.fi
Sat Jan 20 21:17:50 EST 2018


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20180121/7d271cf7/attachment.html>


More information about the Pythonmac-SIG mailing list