How to use the pyvirtualdisplay.util.py2 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
else:
            with _mutex:
                self.display = _search_for_display(randomizer=self._randomizer)
                while self.display in _USED_DISPLAY_NR_LIST:
                    self.display += 1
                self.new_display_var = ":%s" % int(self.display)

                _USED_DISPLAY_NR_LIST.append(self.display)

        self._command = self._cmd() + self._extra_args
        log.debug("command: %s", self._command)

        self._stdout_file = tempfile.TemporaryFile(prefix="stdout_")
        self._stderr_file = tempfile.TemporaryFile(prefix="stderr_")

        if py2() or not self._has_displayfd:
            self._subproc = subprocess.Popen(
                self._command,
                stdout=self._stdout_file,
                stderr=self._stderr_file,
                shell=False,
            )
        else:
            if self._has_displayfd:
                self._subproc = subprocess.Popen(
                    self._command,
                    pass_fds=[self._pipe_wfd],
                    stdout=self._stdout_file,
                    stderr=self._stderr_file,
                    shell=False,
                )
        if self._has_displayfd: