Giter Club home page Giter Club logo

pyvirtualdisplay's People

Contributors

abraha2d avatar avdn avatar elias481 avatar kingdread avatar mbrunthaler avatar ozans avatar ponty avatar robethx avatar russian-developer avatar toofar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyvirtualdisplay's Issues

Resizable Xephyr window in PyVirtualDisplay

Not sure if this is exactly a bug, but I just wanted to document this:

I had wanted a resizeable window when I use PyVirtualDisplay - and it turns out it is a relatively easy hack - simply add this line in /usr/local/lib/python2.7/dist-packages/pyvirtualdisplay/xephyr.py (tested on Ubuntu 14.04):

    @property
    def _cmd(self):
        cmd = [PROGRAM,
               dict(black='-br', white='-wr')[self.bgcolor],
               '-screen',
               'x'.join(map(str, list(self.size) + [self.color_depth])),
               '-resizeable',   # add this line
               self.new_display_var,
               ]
        return cmd

Unable to specify custom DISPLAY

Perhaps I missed it in the docs and the code, but is there any way to set the DISPLAY value? I'm unable to get this package to work on a headless server, and I'm trying to debug what DISPLAY variable this uses for Xvfb, but there doesn't seem to be any specified in xvfb.py, nor does it seem to allow you to specify one.

All the docs I can find on Xvfb say it should be called like Xvfb :99, but the command generated in XvfbDisplay._cmd doesn't set this variable. Wouldn't that prevent it from working on a headless server?

Dublicate display number in celery.

Hello, i use PyVirtualDisplay==0.1.5 to take screenshots in celery.

        self.DISPLAY = SmartDisplay(visible=0, size=(2560, 1600), bgcolor='black').start()
        print u"Create display...%s" % self.DISPLAY.new_display_var

But sometimes new_display_var is dublicate for two workers:

[2016-02-12 04:23:20,879: WARNING/Worker-2] DISPLAY: :1098
[2016-02-12 04:44:08,713: WARNING/Worker-3] DISPLAY: :1098

Please help, thank you.

`Display was started twice` even though `stop` was called

Hello,

I am having an issue and my use case is the simplest you can imagine.

I am simply executing these lines:

from pyvirtualdisplay import Display

display = Display()
display.start()
display.stop()
display.start()

The last line generates the following exception:

File "/Users/seba/PycharmProjects/fortress/.venv/lib/python3.8/site-packages/pyvirtualdisplay/display.py", line 72, in start
    self._obj.start()
  File "/Users/seba/PycharmProjects/fortress/.venv/lib/python3.8/site-packages/pyvirtualdisplay/abstractdisplay.py", line 148, in start
    raise XStartError(self, "Display was started twice.")
pyvirtualdisplay.abstractdisplay.XStartError: (<pyvirtualdisplay.xvfb.XvfbDisplay object at 0x10d66bd30>, 'Display was started twice.')

It looks like the display hasn't actually been stopped. I am having this issue both in local (Mac OS X machine) and in a GCP machine. Is there anything trivial I am missing?

Send mouse and keyboard inputs

Hi,

I want to automate a little program. However when using PyAutoGui for sending key strokes and moving/clicking with the mouse the actions happen on my real display and not the virtual one. How can I achieve that these events are executed inside the virtual display?
I tried vncdotool already, however the application seems to be not really supported/working anymore :(

Best
Karol

-resizeable option not on version of Xephyr bundled with xquartz 2.7.11

There are a couple options which don't exist for this version of xephyr/x/(etc) and break the library on MacOS Catalina. Notably, -resizeable and -displayfd. The latter is not an issue as long as check_startup is not passed to Display(...).

If you'd be willing to accept it I can PR a fix which allows Display(..., resizeable=False) and provides some better output for mac users (I kicked myself when I realized trying to debug with check_startup was the issue I was trying to debug).

PyPi Release 0.1.4

With Issue #10 fixed, I'm looking forward to a new release on PyPi so I don't have to install using git+ssh. Any plan of doing a minor release soon?

RAM consumption Xvfd reaches almost 100%

I have a script working on a server. Over time, as I can see in the dashboard of my server, the RAM consumption of Xvfd is increasing and reaching almost 100%. Here's my code:

from pyvirtualdisplay

display = Display(visible=0, size=(800, 600))
display.start()
# some staff

display.sendstop()

Am I releasing the Xvfd correctly?

KeyError when env doesn't have a DISPLAY

xephyr=Display(visible=1, size=(320, 240)).start() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/pyvirtualdisplay/abstractdisplay.py", line 65, in start self.old_display_var = os.environ['DISPLAY'] File "/usr/lib/python2.6/UserDict.py", line 22, in __getitem__ raise KeyError(key) KeyError: 'DISPLAY'

Easily fixed by adding DISPLAY to the environment with
$: export DISPLAY=':0'

Could handle the exception with a message or needs some logic to handle if DISPLAY doesn't exist. How about:

-        self.old_display_var = os.environ['DISPLAY']
+         self.old_display_var = os.environ['DISPLAY'] if 'DISPLAY' in os.environ else ':0'

Add VNC -rfbauth option

Due to a bug (here and here) with selenium/chromedriver/chrome not correctly sending keystrokes when running tightvnc server, I had to switch to using vnc4server if I wanted to peek at what was happening while running PyVirtualDisplay.

I believe vnc4server requires a password (at least on my systems it does) and whatever password file it defaults to when called by PyVirtualDisplay was not accessible.

So on import, I redifined XvncDisplay._cmd to specify a password file location (set by running vncpasswd):

from pyvirtualdisplay.xvnc import XvncDisplay
@property
def _cmd(self):
        cmd = ['Xvnc',
               '-depth', str(self.color_depth),
               '-geometry', '%dx%d' % (self.size[0], self.size[1]),
               '-rfbport', str(self.rfbport), '-rfbauth', '/etc/vncpasswd',
               self.new_display_var,
               ]
        return cmd
XvncDisplay._cmd =_cmd

I'd suggest adding this as an option available when creating a Display (or providing a more universal option to add any additional arguments when calling Xvnc).

The same syntax applies to tightvncserver as well as vnc4server (and I believe RealVNC and x11vnc as well, since they all default themselves to the Xvnc executable on install).

import error on fresh install

line 2 of abstractdisplay.py should be "import os.path as path" instead of "import path from path". I fixed my copy locally and it is working fine, but I just wanted to contribute the fix upstream so all can benefit.

Please release a new stable version.

PyVirtualDisplay appears to have entered its senescent phase.

This is perfectly normal, of course. Even the most prolific software projects inevitably decline and dwindle into that good twilight world of historical obscurity.

That is Not Dead Which Can Eternal Lie

In this case, however, PyVirtualDisplay is still widely used elsewhere โ€“ including as a mandatory dependency of InstaPy, SeleniumBase, and pytest-xvfb. If PyVirtualDisplay summarily dies, all downstream packages either die as well or are required to significantly refactor their integration and support for X.

Neither of these two alternatives are ideal. In fact, both plainly suck.

The Midnight Hour is Close at Hand

It's to the benefit of all involved that we keep PyVirtualDisplay alive as long as possible. The last stable release was two-and-a-half years ago and fails to explicitly support Python >= 3.6. That's... not so good.

If you no longer have the time or inclination to maintain PyVirtualDisplay, @ponty, that's perfectly understandable. In the interest of avoiding a community-driven fork, would granting repository push access to a proven community member (e.g., @Elias481) be feasible? If not, would temporarily resuscitating PyVirtualDisplay yourself for one final stable release be feasible?

But Wait... There's More!

Sadly, releasing a new PyVirtualDisplay version is probably the least of the pending work that needs doing. Fun unpaid chores also include:

  • Explicitly testing and supporting Python 3.7.
  • Either merging or closing all open pull requests โ€“ all of which seem fairly useful and constructive.
  • At least commenting on all open issues, some of which are over three years old. Ideally, issues that are not realistically resolvable should simply be closed.

All that Begins Ends, Too

And... I'm done now.

Thanks for the many intrepid years of open-source volunteerism, @ponty. Whichever way you and PyVirtualDisplay elect to go, at least we'll always have version 0.2.1 and our shared memories of stabler, faster, and better supported days.

Pineapple express emoji for all! ๐Ÿ ๐Ÿš‹

add tightvnc support

With tightvncserver installed on a Ubuntu server I can use a vnc client to connect to the xvfb display by doing

export DISPLAY=:1
vncserver :1
python my_webdriver_script.py

then connecting to port 5901

It would be great if the same functionality could be added to pyvirtualdisplay somehow.

Have a better way to get unique display number

Currently there's the RANDOMIZE_DISPLAY_NR users can patch to get better concurrent behavior but it's contrived to use.

Could we have a better API for this? Or maybe an atomic "get number and lock file"?

Firefox menu not grabbed by waitgrab

Firefox menu is not captured by waitgrab(), is there a way to get it?

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from pyvirtualdisplay.smartdisplay import SmartDisplay
import pyautogui, time

display = SmartDisplay(size=(1280, 720), bgcolor="black", backend="xvfb")
display.start()
driver = webdriver.Firefox(firefox_binary="./firefox/firefox-bin", executable_path="./geckodriver")
time.sleep(10)
pyautogui.moveTo(1130, 65)  # The firefox menu button position
pyautogui.click()
time.sleep(5)
display.waitgrab().save("screenshot.png")

screenshot

Can PyVirtualDisplay be used in parallel threads without issues?

Hello,

I am starting multiple PyVirtualDisplay Xvfb displays in a few parallel threads using the threading module. and I was wondering if this can cause any problem (like one display starts inside another)?

I'm currently doing it this way:

import threading
from selenium import webdriver
from pyvirtualdisplay import Display

def thread():
    display = Display(visible=0, size=(1024, 768), backend="xvfb")
    display.start()
    browser = webdriver.Firefox()
    browser.get('https://google.com')
    browser.quit()
    display.stop()

def main():
    # Start 15 threads
    for i in range(15):
        t = threading.Thread(target=thread)
        t.start()

if __name__ == "__main__":
    main()

Kind regards.

Problems with easy_install of PyVirtualDisplay

Hello,

Love PyVirtualDisplay but easy_install doesn't work for me on all but one system I have available for testing. I get this error. BTW, pip install does work fine.

easy_install pyvirtualdisplay

(( much snippage ))

Traceback (most recent call last):
File "/hx/u/hschilli/openmdao/T777-add-gui-javascript-unit-tests/devenv/bin/easy_install", line 8, in
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1712, in main
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1716, in
File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
cmd_obj.run()
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 211, in run
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 446, in easy_install
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 478, in install_item
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 519, in process_distribution
File "build/bdist.linux-i686/egg/pkg_resources.py", line 563, in resolve
plugin_env, full_env=None, installer=None, fallback=True
File "build/bdist.linux-i686/egg/pkg_resources.py", line 799, in best_match

File "build/bdist.linux-i686/egg/pkg_resources.py", line 811, in obtain
self.add(other)
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 446, in easy_install
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 476, in install_item
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 655, in install_eggs
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 930, in build_and_install
File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 919, in run_setup
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 62, in run_setup
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 105, in run
File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 64, in
File "setup.py", line 6, in
sys.path.insert(0, os.path.normpath(os.path.join(here,
zipimport.ZipImportError: bad local file header in paver-minilib.zip

XStartTimeoutError since v2.0

Since upgrading to v2.0, I sometimes see this on GitHub Actions:

Wed, 20 Jan 2021 17:02:27 GMT py36-pyqt512 run-test: commands[1] | /home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/bin/python -bb -m pytest tests
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR> Traceback (most recent call last):
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/_pytest/main.py", line 265, in wrap_session
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     config._do_configure()
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/_pytest/config/__init__.py", line 982, in _do_configure
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pluggy/hooks.py", line 308, in call_historic
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pluggy/manager.py", line 93, in _hookexec
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pluggy/manager.py", line 87, in <lambda>
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     return outcome.get_result()
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     raise ex[1].with_traceback(ex[2])
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     res = hook_impl.function(*args)
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pytest_xvfb.py", line 93, in pytest_configure
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     config.xvfb.start()
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pytest_xvfb.py", line 54, in start
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     self._virtual_display.start()
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pyvirtualdisplay/display.py", line 70, in start
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     self._obj.start()
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pyvirtualdisplay/abstractdisplay.py", line 152, in start
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     self._start1_has_displayfd()
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pyvirtualdisplay/abstractdisplay.py", line 200, in _start1_has_displayfd
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     self.display = int(self._wait_for_pipe_text(rfd))
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>   File "/home/runner/work/qutebrowser/qutebrowser/.tox/py36-pyqt512/lib/python3.6/site-packages/pyvirtualdisplay/abstractdisplay.py", line 295, in _wait_for_pipe_text
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR>     % (self._program, self._command,)
Wed, 20 Jan 2021 17:02:44 GMT INTERNALERROR> pyvirtualdisplay.abstractdisplay.XStartTimeoutError: No reply from program Xvfb. command:['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '800x600x16', '-displayfd', '10']

This is with pytest-xvfb which is a rather small wrapper around PyVirtualDisplay.

I think it only happens in the Ubuntu 18.04 environment, not with 20.04. Also it only happens one out of 10 times or so...

Any idea what could be going on there?

DPI spec support

In addition to specifying the display height and width, I need to specify the display dpi, to Xvfb, via the -dpi flag. The default value of 100 dpi in Xvfb doesn't match my physical display of 96.

Check the display successfully starts before returning (2)

After checking for successfull start it should be verified that the display found running with xdpyinfo is really the display we started.
If multiple python processes open new display at the same time it's possible that the same target display number is allocated by multiple instances the same time.
First X server process started will successfully come up of course, but the other processes just see the X-Server at that displaynumber running and do not complain.
Problem occurs (in our case) when the real owner of the process calls the displays close/shuts down the process. All other processes using this X Server are now getting problems. (Probably problems can arise even before if the script needs a dedicated/unshared X server instance to be successfull.)

I see with random display number I can minimize chances that this happens, but anyway I cannot be sure (without setting MIN_DISPLAY_NUMBER explicitly to some unused range what is quite inconvenient as we would need to assign a unique MIN_DISPLAY_NUMBER to every script running on that server).

Currently I had to implement something like the following to avoid running into the problem, but it would be fine if the API would handle this.

    def start_display(tries, *args, **kwargs):
        display = Display(*args, **kwargs)
        display.start()
        dispstarttry = 1
        while not display.is_alive():
            if dispstarttry >= tries:
                display.wait()
                print('Could start display after %d tries\nXvfb output last try:\nSTDOUT:\n-----------------------\n%s\nSTDERR:\n-----------------------\n%s'
                      % (dispstarttry, display.stdout, display.stderr))
                sys.exit(2)
            display.close()
            display = Display(*args, **kwargs)
            display.start()
            dispstarttry += 1
        return display

'Display' object has no attribute 'is_started'

Hi! After the new release (1.0.0) I'm getting the following error:

AttributeError: 'Display' object has no attribute 'is_started'

After looking for a solution for this problem, I realized that Display object is exposing the is_alive() method from the inner AbstractDisplay.

def is_alive(self):

Then, my question is if I can start using this method obtaining the same behavior. The use case I was solving with is_started is to start the display if it's not already started:

display = Display(...)
...
if not display.is_started:
    display.start()

When os.environ has no DISPLAY variable, PyVirtualDisplay sets it to ":0" when calling stop() instead of deleting it

Hi,

First, thank you for the great library. I believe I've found a bug.
You fixed Issue #2 by adding a default DISPLAY of ":0" when stopping the display. This is an issue if we try to create multiple displays sequentially, because stop() is incorrectly leaving the DISPLAY environment variable set, when the key should be deleted. I have the same use-case as Issue #2, where the CentOS machine I am running on does not have a DISPLAY environment variable by default.

See script/output below, and let me know if you need any more details. I am using xvfb on a CentOS server that has no DISPLAY by default.

import os
import time
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary


def start():
    display = None

    if 'DISPLAY' not in os.environ:
        print("  Bringing up a new display, because os.environ does not have one.")
        display = Display(visible=False, size=(1920, 1200))  # TODO is this cheating?? Huge resolution.
        display.start()

        print("  Started pyvirtualdisplay with backend '%s', screen '%s'." % (display.backend, display.screen))
    else:
        print("  Environ DISPLAY is '%s', no need to use pyvirtualdisplay." % os.environ['DISPLAY'])

    # TODO do we need to sleep here for the display to start?

    try:
        with open("/tmp/firefoxLog.txt", 'w') as log_file:
            binary = FirefoxBinary(firefox_path='/usr/bin/firefox', log_file=log_file)
            browser = webdriver.Firefox(firefox_binary=binary)
            browser.get("http://www.google.com")
    except:
        if display:
            print("  Stopping display because the browser failed to come up.")
            display.stop()
        else:
            print("  No need to stop display, because we did not make one earlier.")

        raise

    return display, browser


def stop(display, browser):
    if browser:
        print "  Quitting browser"
        browser.quit()
    if display:
        print "  Stopping display"
        display.stop()


print "TEST1"
d1, b1 = start()
time.sleep(3)
stop(d1, b1)

time.sleep(2)

print "\nTEST2"
d2, b2 = start()
time.sleep(3)
stop(d2, b2)


exit(0)

I believe this can be fixed by deleting "DISPLAY" from the environ dictionary if it was not there when we initially started.

Thank you!

`Display.__repr__` raises `AttributeError` if invoked before `Display.start()`

Reproduce

display = Display()
  # ... truncated stacktrace ...
/lib/python2.7/site-packages/easyprocess/__init__.pyc in __repr__(self)
    135         msg = '<%s cmd_param=%s alias={alias} cmd=%s ({scmd}) oserror=%s returncode=%s stdout="%s" stderr="%s" timeout=%s>' % (
    136             self.__class__.__name__,
--> 137             self.cmd_param,
    138             self.cmd,
    139             self.oserror,
AttributeError: Display instance has no attribute 'cmd_param'

Cause:

AbstractDisplay, being an instance of EasyProcess, does not define EasyProcess.cmd_param until EasyProcess. __init__ is invoked

I understand why you do not want to call EasyProcess. __init__ until AbstractDisplay.start(), but that leaves this edge case.

Proposed solutions

  1. in AbstractDisplay.__init__, set a dummy cmd_param attribute
  2. implement AbstractDisplay.__repr__ and handle the case where start() has not been invoked
  3. encourage use of displays in a context manager, e.g.
import contextlib
import pyvirtualdisplay

@contextlib.contextmanager
def virtual_display(*display_pargs, **display_kwargs):
  display = pyvirtualdisplay.Display(*display_pargs, **display_kwargs)
  display.start()
  yield
  display.stop()

pyvirtualdisplay + nginx + flask + uwsgi doesn't find Xvfb in PATH

pyvirtualdisplay + nginx + flask + uwsgi doesn't find Xvfb in PATH although it works fine without uwsgi.
also code works fine without pyvirtualdisplay

here is the code

display = Display(visible=False,size=(int(width), int(height)))  
display.start()
 
 
 
 
capability = webdriver.DesiredCapabilities.FIREFOX
capability['handleAlerts'] = True
capability['acceptSslCerts'] = True
capability['acceptInsecureCerts'] = True
capability['javascriptEnabled'] = True
capability['marionette'] = True
 
capability['locationContextEnabled'] = False
capability['applicationCacheEnabled'] = False
capability['browserConnectionEnabled'] = False
capability['databaseEnabled'] = False
 
profile = FirefoxProfile()
#profile.set_preference("browser.privatebrowsing.autostart", True)
profile.set_preference("general.useragent.override",useragent)
profile.set_preference("network.proxy.socks_port",PORT)
profile.set_preference("network.proxy.socks",PROXY)
profile.set_preference("network.proxy.type",1)
profile.set_preference("network.proxy.http",PROXY)
profile.set_preference("network.proxy.http_port",PORT)
profile.set_preference("network.proxy.ssl_port",PORT)
profile.set_preference("network.proxy.ssl",PROXY)
 
profile.set_preference("intl.accept_languages", "en-GB, en")
profile.set_preference("browser.search.countryCode", "GB")
 
profile.set_preference("geo.enabled", False)
 
ops = Options()  
ops.log.level="error"
binary = FirefoxBinary(firefox_path = 'firefoxpath')
driver = webdriver.Firefox(firefox_binary=binary, firefox_options = ops,executable_path='/usr/local/bin/geckodriver', capabilities = capability, firefox_profile = profile)

################################
do something
################################
 
driver.stop()

here is an error what we have

Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     response = self.full_dispatch_request()
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     rv = self.handle_user_exception(e)
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     reraise(exc_type, exc_value, tb)
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     raise value
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     rv = self.dispatch_request()
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     return self.view_functions[rule.endpoint](**req.view_args)
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "./flaskapp.py", line 315, in hello
Oct 16 05:06:29 instance-3 uwsgi[5588]:     findcanvas(screenjson)
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "./flaskapp.py", line 77, in findcanvas
Oct 16 05:06:29 instance-3 uwsgi[5588]:     display = Display(visible=False,size=(int(width), int(height)))
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     self._obj = self.display_class(
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     cls.check_installed()
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     ubuntu_package=PACKAGE).check_installed()
Oct 16 05:06:29 instance-3 uwsgi[5588]:   File "/home/ubuntu/anaconda3/envs/flaskappenv/lib/python3.7/site-p
Oct 16 05:06:29 instance-3 uwsgi[5588]:     raise EasyProcessCheckInstalledError(self)
Oct 16 05:06:29 instance-3 uwsgi[5588]: easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb', '-help']
Oct 16 05:06:29 instance-3 uwsgi[5588]: OSError=[Errno 2] No such file or directory: 'Xvfb': 'Xvfb'
Oct 16 05:06:29 instance-3 uwsgi[5588]: Program install error!

How to take screen number?

Thank you for your useful package.

I uses PyVirtualDisplay to visualize reinforcement learning environment (OpenAI Gym) on Google Corab, so that I need display number and screen number to set os.environ["DISPLAY"] = f":{display}.{screen}"

  • Until version 0.2.5, screen number was Display.screen
  • From version 1.0 to version 1.3, screen number was Display._obj.screen
  • From version 1.3.1, screen number is Display._obj._screen

Are there any stable method to take screen number?
(or is it guaranteed that the screen number is always 0?)

Ignore passing diplay size from variable

Whet I trying to pass display size from variable, that taken from text file, pyvirtual ignore it and starts dizplay with width 1px and height 3-6px
When I print display size like (1366, 768) in same script in works perfect.
So, I've also tried to replace quotes (' and ") fron variable, but it gives same result.

KeyError when DISPLAY not peresent in ENV

This happens when I am running selenium script in a docker, not sure exactly when:

Traceback (most recent call last):
  File "/crawler/session.py", line 47, in __del__
    self.display.stop()
  File "/usr/local/lib/python3.5/dist-packages/pyvirtualdisplay/abstractdisplay.py", line 118, in stop
    self.redirect_display(False)
  File "/usr/local/lib/python3.5/dist-packages/pyvirtualdisplay/abstractdisplay.py", line 87, in redirect_display
    del os.environ['DISPLAY']
  File "/usr/lib/python3.5/os.py", line 741, in __delitem__
    raise KeyError(key) from None
KeyError: 'DISPLAY'

Not sure if this was overlooked or I do something wrong.

Bottom line is that in most places in the code similar issues with display not being part of env were navigated, this one seems like forgotten fix.

File not found error using PyvirtualDisplay in windows

C:\Users\Jalal\.conda\envs\chatter_bot\python.exe C:/Users/Jalal/PycharmProjects/chatbot_with_questions_suggestions/temp.py
Traceback (most recent call last):
  File "C:\Users\Jalal\.conda\envs\chatter_bot\lib\site-packages\easyprocess\__init__.py", line 169, in start
    cmd, stdout=stdout, stderr=stderr, cwd=self.cwd, env=self.env,
  File "C:\Users\Jalal\.conda\envs\chatter_bot\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Jalal\.conda\envs\chatter_bot\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Jalal/PycharmProjects/chatbot_with_questions_suggestions/temp.py", line 3, in <module>
    xephyr=Display(visible=1, size=(320, 240)).start()
  File "C:\Users\Jalal\.conda\envs\chatter_bot\lib\site-packages\pyvirtualdisplay\display.py", line 58, in __init__
    **kwargs
  File "C:\Users\Jalal\.conda\envs\chatter_bot\lib\site-packages\pyvirtualdisplay\xephyr.py", line 45, in __init__
    extra_args=extra_args,
  File "C:\Users\Jalal\.conda\envs\chatter_bot\lib\site-packages\pyvirtualdisplay\abstractdisplay.py", line 87, in __init__
    helptext = get_helptext(program)
  File "C:\Users\Jalal\.conda\envs\chatter_bot\lib\site-packages\pyvirtualdisplay\util.py", line 10, in get_helptext
    p.call()
  File "C:\Users\Jalal\.conda\envs\chatter_bot\lib\site-packages\easyprocess\__init__.py", line 141, in call
    self.start().wait(timeout=timeout)
  File "C:\Users\Jalal\.conda\envs\chatter_bot\lib\site-packages\easyprocess\__init__.py", line 174, in start
    raise EasyProcessError(self, "start error")
easyprocess.EasyProcessError: start error <EasyProcess cmd_param=['Xephyr', '-help'] cmd=['Xephyr', '-help'] oserror=[WinError 2] The system cannot find the file specified return_code=None stdout="None" stderr="None" timeout_happened=False>

Process finished with exit code 1

Check the display successfully starts before returning

(Fix this TODO)

We use the xdpyinfo tool in our own code to check if a X server is working.

Code something like this would work;

start_time = time.time()
while time.time() - start_time < START_TIMEOUT:
    # We don't explicitly set the display, as we want to check the
    # environment value.
    exit_code = subprocess.call(['xdpyinfo'])
    if exit_code == 0:
        logging.info('Successfully started Xvfb with display "%s".', display)
        return
    logging.warn('xdpyinfo check failed with exit code %s while starting Xvfb on "%s".', exit_code, display)
    time.sleep(0.1)
logging.fatal('Failed to start Xvfb on display "%s" (xdpyinfo check failed).', display)

Version lock EasyProcess in setup.py; latest version (0.3) breaks PyVirtualDisplay

install_requires = ["EasyProcess"]

A new version of EasyProcess (v0.3) was released. https://pypi.org/project/EasyProcess/#history, that has removed deprecated functions check and check_installed. See: ponty/EasyProcess@a75d640 and ponty/EasyProcess@8f410e0

This is now breaking PyVirtualDisplay (v0.2.1):

...
  File "/usr/local/lib/python3.6/dist-packages/pyvirtualdisplay/display.py", line 34, in __init__
    self._obj = self.display_class(
  File "/usr/local/lib/python3.6/dist-packages/pyvirtualdisplay/display.py", line 52, in display_class
    cls.check_installed()
  File "/usr/local/lib/python3.6/dist-packages/pyvirtualdisplay/xvfb.py", line 38, in check_installed
    ubuntu_package=PACKAGE).check_installed()
TypeError: __init__() got an unexpected keyword argument 'url'

Output from X client is discarded

[I'm looking at Xvfb in particular, but I believe the issues apply across the board.]

Xvfb generates (stderr) output as it runs, which is useful for debugging. PyVirtualDisplay discards this output.

It would be desirable to either:

  1. be able to specify a destination file in XvfbDisplay constructor for stderr.

    or

  2. have the stderr output passed to a logger object, so I can see it/redirect it/suppress it through the standard Python mechanism.

TypeError: __init__() got an unexpected keyword argument 'url'

I have some code that uses the pyvirtualdisplay package and it works fine.

pyvirtualdisplay.Display calls EasyProcess like this:

       @classmethod
       def check_installed(cls):
           EasyProcess([PROGRAM, '-help'], url=URL,
                       ubuntu_package=PACKAGE).check_installed()

I made a branch and made some changes. In the branch, when I
instantiate Display and it gets to this point it fails with:

TypeError: init() got an unexpected keyword argument 'url'

There are no changes in my branch related to using Display. What's
very odd is that the init() function for EasyProcess has this
signature, and the call to it from Display is the same in my master
branch and it works:

    def __init__(
        self, cmd, cwd=None, use_temp_files=True, env=None,
    ):

So that url param must be getting passed to something else.

I did some googling and found a post on SO where someone was having
the same issue, and the answer was that they overrode the EasyProcess
init with their own init. If I am doing that I have no clue how
that could be. I did inspect EasyProcess just before the call and it
was the correct code.

Here is the end of the stack trace:

-> display = Display(visible=0, size=(800, 600))
> /usr/local/lib/python3.7/site-packages/pyvirtualdisplay/display.py(33)__init__()
-> self._obj = self.display_class(
  /usr/local/lib/python3.7/site-packages/pyvirtualdisplay/display.py(51)display_class()
-> cls.check_installed()
  /usr/local/lib/python3.7/site-packages/pyvirtualdisplay/xvfb.py(38)check_installed()
-> ubuntu_package=PACKAGE).check_installed()


Anyone have any thoughts on what could be causing this or how I can
debug it further?

0.2.3 broken on Windows

PyVirtualDisplay is no longer working on Windows after PR #35. We do selenium testing in both Linux and Windows. Everything works great with PyVirtualDisplay v0.21, but fails with timeouts when we use v0.2.3.

Per the PyVirtualDisplay listing on pypi, it is an OS Independent library... so we need to change this useful check on the X Server so PyVirtualDisplay still words cross-platform.

This PR added a check to make sure the X Server used is solely used by PyVirtualDisplay to avoid a race condition. This is a helpful change. Unfortunately, the OS library used was fcntl, which is only available on Unix/Linux , and that breaks cross-platform ability of PyVirtualDisplay >0.2.1.

Short term, in abstractdisplay.py we could change line 46 with functionality to only do this check if NOT on a windows machine.
current code:

if self.check_startup:
....do stuff

Sample code:

import platform
self.check_startup and platform.system() != "Windows":
....do stuff
else:
....pass

Long Term - Could fcntl be replaced with a cross-platform library calledportalocker? This adds a python dependency but is fully cross-platform Links on pypi and github.

I'm not familiar with the details of PyVirtualDisplay, but would be glad to help draft a fix and do regression testing on both Windows and Linux.

Make Display support the context manager protocol

A common way to use pyvirtualdisplay is to start up a display, do some things with applications in that display, then stop it. It would be nice if the with statement could be used to control the lifecycle of the display in such scenarios. For example:

with Display(visible=0, size=(800, 600)):
    browser = webdriver.Firefox()
    browser.get('http://www.google.com')
    browser.save_screenshot('screenshot_of_google_in_firefox.png')
    browser.quit()

To support this, the Display class (or one of its super classes) would have to support the context manager protocol, the implementation would probably look something like this:

class AbstractDisplay(EasyProcess):
    # ... all existing code still remains as is, but this is added:
    def __enter__(self):
        self.start()
        return self
    def __exit__(self, *exc_info):
        self.stop()

Support -fbdir option in Xvfb

Xvfb supports an option to have the virtual screen memory-mapped to a file in a given directory. This is useful for debugging.

The constructor for XvfbDisplay should optionally accept a directory name. If non-null, it should be included as a command-line parameter in _cmd.

Get X Display number

I would like to know how to determine the X Display number that is getting assigned by PyVirtualDisplay when set for Xvfb. I want to have ffmpeg record the xvfb display, but I'm not sure what input to give it. I tried running the "w" command from a console window, but it is only indicating the default :0 display.

Versions 1.1 causes error with pytest_xvfb

This might be an incompatibility between pytest_xvfb and pyvirtualdisplay 1.0+, but my travis CI jobs have started failing with the below exception. The full travis log is here.

  File "/home/travis/miniconda/envs/test/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/travis/miniconda/envs/test/lib/python3.7/site-packages/pytest_xvfb.py", line 99, in pytest_unconfigure
    config.xvfb.stop()
  File "/home/travis/miniconda/envs/test/lib/python3.7/site-packages/pytest_xvfb.py", line 61, in stop
    self._virtual_display.stop()
  File "/home/travis/miniconda/envs/test/lib/python3.7/site-packages/pyvirtualdisplay/display.py", line 76, in stop
    self._obj.stop()
  File "/home/travis/miniconda/envs/test/lib/python3.7/site-packages/pyvirtualdisplay/abstractdisplay.py", line 313, in stop
    raise XStartError("stop() is called before start().")
pyvirtualdisplay.abstractdisplay.XStartError: stop() is called before start().

For now I can probably limit the version of pyvirtualdisplay, but wanted to check this was expected.

Problems with easy_install of PyVirtualDisplay

I don't have permissions to re-open the original bug but on all systems I've tried (Ubuntu, Debian), I'm getting an error when I run easy_install pyvirtualdisplay. I understand that this was fixed at one point but now appears to be broken a again. This is using python 2.7.
Processing entrypoint2-0.0.3.tar.gz
Running entrypoint2-0.0.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ZedArx/entrypoint2-0.0.3/egg-dist-tmp-clJihS
Traceback (most recent call last):
File "/usr/bin/easy_install", line 9, in
load_entry_point('distribute==0.6.16dev-r0', 'console_scripts', 'easy_install')()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1912, in main
with_ei_usage(lambda:
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1893, in with_ei_usage
return f()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1916, in
distclass=DistributionWithoutHelpCommands, **kw
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 364, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 604, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 636, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 688, in process_distribution
[requirement], self.local_index, self.easy_install
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 544, in resolve
dist = best[req.key] = env.best_match(req, self, installer)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 786, in best_match
return self.obtain(req, installer) # try and download/install
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 798, in obtain
return installer(requirement)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 604, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 634, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 824, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1101, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1090, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 29, in run_setup
lambda: execfile(
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 70, in run
return func()
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 31, in
{'file':setup_script, 'name':'main'}
File "setup.py", line 6, in
zipimport.ZipImportError: bad local file header in paver-minilib.zip

python: Fatal IO error 0 (Success) on X server

I get the above error message when the following pyqt script terminates

import sys

import pyvirtualdisplay
# Import the core and GUI elements of Qt
from PyQt4.QtCore import *
from PyQt4.QtGui import *


virtual_display = pyvirtualdisplay.Display(
    backend='xvfb', size=(800, 600),
    color_depth=16, use_xauth=False)
virtual_display.start()
if not virtual_display.is_alive():
    ret = virtual_display.return_code
    raise RuntimeError("Xvfb exited with exit code {0}".format(ret))

qt_app = QApplication(sys.argv)
label = QLabel('Hello, world!')
label.show()

# Run the application's event loop
# qt_app.exec_()
virtual_display.stop()

This error message causes the process to return a non-zero exit status

> echo $?
1

I tested this in a cpython3.6 conda environemnt with pyqt-4.11.4 and pyvirtualdisplay-0.2.1. To fix this we probably have to stop the xvfb virtual display after the pyqt part disconnected itself from xvfb, right? But how is this possible?

See also The-Compiler/pytest-xvfb#11 and The-Compiler/pytest-xvfb#1

API to pass custom arguments to the underlying X server?

I'm using PyVirtualDisplay in my pytest-xvfb project, and so far that has worked rather well.

pytest-xvfb allows users to pass custom arguments to the underlying Xvfb. It did this by doing the following before the v1.0 release:

disp.args.extend(...)

With v1.0, due to 20f6838, this stopped working. Instead, this seems to work, and is what I thought was a public API (given that it's proc and not _proc):

disp.proc.args.extend(...)

But with v1.1, this seems to break again, due to 0aed783 (which seems to switch to plain subprocess instead of using EasyProcess)?

So now I can't see any possibility to pass custom args anymore... Wasn't 0aed783 a public API break? If that's not supported anymore, would it be possible to add something like an extra_args argument to Display or Display.start()?

Purpose of PyVirtualDisplay

I read online and happen to come across this library and selenium. I am curious to understand what is the purpose of this library?

Based on what I read, I thought we can still continue to scrape data using selenium, without this python wrapper for virtual display? (https://selenium-python.readthedocs.io/getting-started.html)

I wasn't able to find a good documentation to explain this. Can anyone enlighten me? I am not expert in either libraries. Thanks!

I have the problem with PyVirtualDisplay==0.2.5 package for running tests with usage of virtual displays (headless mode)

My tests are working and running as expected with PyVirtualDisplay==0.2.1, but I have a problem with the latest version of this package (for example, PyVirtualDisplay==0.2.5).

My code snippet:

...
def _set_up(self):

    # Creation of instance of the browser.
    self.display = Display(visible=0, size=(config.WIDTH, config.HEIGHT))
    self.display.start()
    desired = self.get_desired_capabilities(config.BROWSER)
    self.driver = webdriver.Remote(command_executor=config.ACTIVE_NODE, desired_capabilities=desired)
    # Maximize window size.
    self.driver.set_window_size(config.WIDTH, config.HEIGHT)
...

Error message:

Error Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 59, in testPartExecutor yield File "/usr/local/Cellar/python/3.7.6/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 624, in run self.setUp() File "/Users/ratmirasanov/Documents/testing/welcome_widget/test_welcome_widget.py", line 24, in setUp self._set_up() File "/Users/ratmirasanov/Documents/testing/utilities.py", line 41, in _set_up self.display.start() File "/Users/ratmirasanov/Documents/testing/venv/lib/python3.7/site-packages/pyvirtualdisplay/abstractdisplay.py", line 171, in start raise XStartTimeoutError(msg % d) pyvirtualdisplay.abstractdisplay.XStartTimeoutError: Failed to start X on display ":1001" (xdpyinfo check failed).

I did not find any working solution to fix this problem. Any help will be appreciated. Thanks.

UPD: The PyVirtualDisplay==0.2.5 package is working as expected on Ubuntu 18.04.3 LTS.

Where is located the xdpyindo program: /usr/bin/xdpyinfo.

The problem is on my Mac (macOS Catalina 10.15.2) with XQuartz (https://www.xquartz.org/index.html) installed (xdpyindo program is located in /opt/X11/bin/xdpyinfo folder).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.