instance.py

changeset 24
94d58d514d69
parent 23
86b42610d5a8
child 29
9dd2e5d57a7c
--- a/instance.py	Sun Jan 21 01:15:01 2018 +0000
+++ b/instance.py	Sun Jan 21 01:53:10 2018 +0000
@@ -46,6 +46,16 @@
             env=os.environ.copy()
             env['BORG_PASSPHRASE']=passphrase
 
+        # Workaround: if launched is a standalone app created with py2app,
+        # borg will fail unless Python environment is reset.
+        # TODO: Of course, this will fail if the system needs the variables
+        # PYTHONPATH or PYTHONHOME set to certain values.
+        if '_PY2APP_LAUNCHED_' in env and env['_PY2APP_LAUNCHED_']=='1':
+            if env==None:
+                env=os.environ.copy()
+            del env['PYTHONPATH']
+            del env['PYTHONHOME']
+
         self.proc=Popen(cmd, env=env, stdout=PIPE, stderr=PIPE, stdin=PIPE)
 
         # We don't do passphrase input etc.

mercurial