How to use the pyvirtualdisplay.abstractdisplay.XStartTimeoutError function in PyVirtualDisplay

To help you get started, we’ve selected a few PyVirtualDisplay examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ponty / PyVirtualDisplay / pyvirtualdisplay / abstractdisplay.py View on Github external
s = ""
        start_time = time.time()
        while True:
            (rfd_changed_ls, _, _) = select.select([rfd], [], [], 0.1)
            if not self.is_alive():
                raise XStartError(
                    "%s program closed. command: %s stderr: %s"
                    % (self._program, self._command, self.stderr)
                )
            if rfd in rfd_changed_ls:
                c = os.read(rfd, 1)
                if c == b"\n":
                    break
                s += c.decode("ascii")
            if time.time() - start_time >= _X_START_TIMEOUT:
                raise XStartTimeoutError(
                    "No reply from program %s. command:%s"
                    % (self._program, self._command,)
                )
        return s
github ponty / PyVirtualDisplay / pyvirtualdisplay / abstractdisplay.py View on Github external
pass
                else:
                    log.info('Successfully started X with display "%s".', d)
                    ok = True
                    break

                if time.time() - start_time >= _X_START_TIMEOUT:
                    break
                time.sleep(_X_START_TIME_STEP)
            if not self.is_alive():
                log.warning("process exited early. stderr:%s", self.stderr)
                msg = "Failed to start process: %s"
                raise XStartError(msg % self)
            if not ok:
                msg = 'Failed to start X on display "%s" (xdpyinfo check failed, stderr:[%s]).'
                raise XStartTimeoutError(msg % (d, xdpyinfo.stderr))

        return self