def _setup_xauth(self): """ Set up the Xauthority file and the XAUTHORITY environment variable. """ handle, filename = tempfile.mkstemp(prefix="PyVirtualDisplay.", suffix=".Xauthority") self._xauth_filename = filename os.close(handle) # Save old environment self._old_xauth = {} self._old_xauth["AUTHFILE"] = os.getenv("AUTHFILE") self._old_xauth["XAUTHORITY"] = os.getenv("XAUTHORITY") os.environ["AUTHFILE"] = os.environ["XAUTHORITY"] = filename cookie = xauth.generate_mcookie() xauth.call("add", self.new_display_var, ".", cookie)
def _setup_xauth(self): ''' Set up the Xauthority file and the XAUTHORITY environment variable. ''' handle, filename = tempfile.mkstemp(prefix='PyVirtualDisplay.', suffix='.Xauthority') self._xauth_filename = filename os.close(handle) # Save old environment self._old_xauth = {} self._old_xauth['AUTHFILE'] = os.getenv('AUTHFILE') self._old_xauth['XAUTHORITY'] = os.getenv('XAUTHORITY') os.environ['AUTHFILE'] = os.environ['XAUTHORITY'] = filename cookie = xauth.generate_mcookie() xauth.call('add', self.new_display_var, '.', cookie)