Giter Club home page Giter Club logo

Comments (12)

ponty avatar ponty commented on August 17, 2024 11

Xvfb doesn't start. This is a permission problem. I had the same on TravisCI.
I found this solution: http://blog.tigerteufel.de/?p=476

mkdir /tmp/.X11-unix
sudo chmod 1777 /tmp/.X11-unix
sudo chown root /tmp/.X11-unix/

from pyvirtualdisplay.

ponty avatar ponty commented on August 17, 2024 1

I installed XQuartz on OSX:

$ brew cask install xquartz
$ brew cask info xquartz 
xquartz: 2.7.11 (auto_updates)
https://www.xquartz.org/
/usr/local/Caskroom/xquartz/2.7.11 (74.6MB)
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/xquartz.rb
==> Name
XQuartz
==> Artifacts
XQuartz.pkg (Pkg)


$ PATH="$PATH:/opt/X11/bin"

I checked xdpyinfo, no problem:

$ xdpyinfo -version
xdpyinfo 1.3.2

$ (Xvfb -br -nolisten tcp -screen 0 1366x768x24 :1001 &);sleep 0.1;DISPLAY=:1001 xdpyinfo 
name of display:    :1001
version number:    11.0
vendor string:    The X.Org Foundation
vendor release number:    11804000
X.Org version: 1.18.4
maximum request size:  16777212 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    6
...

I checked PyVirtualDisplay, no problem:

# run.py
from pyvirtualdisplay import Display
import logging
FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
logging.basicConfig(level=logging.DEBUG, format=FORMAT)

display = Display(visible=0, size=(300, 200))
display.start()
$ python3 run.py
2020-01-26 09:51:13,022 - easyprocess - DEBUG - command: ['Xvfb', '-help']
2020-01-26 09:51:13,031 - easyprocess - DEBUG - process was started (pid=607)
2020-01-26 09:51:13,036 - easyprocess - DEBUG - process has ended, return code=0
2020-01-26 09:51:13,037 - easyprocess - DEBUG - command: ['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '300x200x24', ':1000']
2020-01-26 09:51:13,038 - easyprocess - DEBUG - command: ['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '300x200x24', ':1001']
2020-01-26 09:51:13,042 - easyprocess - DEBUG - process was started (pid=608)
2020-01-26 09:51:13,043 - pyvirtualdisplay.abstractdisplay - DEBUG - DISPLAY=:1001
2020-01-26 09:51:13,043 - easyprocess - DEBUG - command: ['xdpyinfo']
2020-01-26 09:51:13,079 - easyprocess - DEBUG - process was started (pid=609)
2020-01-26 09:51:13,138 - easyprocess - DEBUG - process has ended, return code=0
2020-01-26 09:51:13,138 - pyvirtualdisplay.abstractdisplay - INFO - Successfully started X with display ":1001".

Can you test the above commands?

from pyvirtualdisplay.

ponty avatar ponty commented on August 17, 2024

xdpyinfo check was added in #25

Enable logging:

import logging
FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
logging.basicConfig(level=logging.DEBUG, format=FORMAT)

What happens if you delete xdpyinfo?

from pyvirtualdisplay.

ratmirasanov avatar ratmirasanov commented on August 17, 2024

I after enabling logging I see the following:

2020-01-06 18:47:56,169 - easyprocess - DEBUG - command: ['Xvfb', '-help']
2020-01-06 18:47:56,257 - easyprocess - DEBUG - process was started (pid=33990)
2020-01-06 18:47:56,912 - easyprocess - DEBUG - process has ended, return code=0
2020-01-06 18:47:56,913 - easyprocess - DEBUG - command: ['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '1366x768x24', ':1000']
2020-01-06 18:47:56,913 - easyprocess - DEBUG - command: ['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '1366x768x24', ':1001']
2020-01-06 18:47:56,917 - easyprocess - DEBUG - process was started (pid=33991)
2020-01-06 18:47:56,918 - pyvirtualdisplay.abstractdisplay - DEBUG - DISPLAY=:1001
2020-01-06 18:47:56,919 - easyprocess - DEBUG - command: ['xdpyinfo']
2020-01-06 18:47:57,002 - easyprocess - DEBUG - process was started (pid=33992)
2020-01-06 18:47:57,948 - easyprocess - DEBUG - process has ended, return code=1

When I removed xdpyinfo program I have the following in logs and my script is working:

2020-01-06 18:53:18,263 - easyprocess - DEBUG - command: ['Xvfb', '-help']
2020-01-06 18:53:18,272 - easyprocess - DEBUG - process was started (pid=34303)
2020-01-06 18:53:18,294 - easyprocess - DEBUG - process has ended, return code=0
2020-01-06 18:53:18,295 - easyprocess - DEBUG - command: ['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '1366x768x24', ':1000']
2020-01-06 18:53:18,296 - easyprocess - DEBUG - command: ['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '1366x768x24', ':1001']
2020-01-06 18:53:18,300 - easyprocess - DEBUG - process was started (pid=34304)
2020-01-06 18:53:18,302 - pyvirtualdisplay.abstractdisplay - DEBUG - DISPLAY=:1001
2020-01-06 18:53:18,304 - easyprocess - DEBUG - command: ['xdpyinfo']
2020-01-06 18:53:18,307 - easyprocess - DEBUG - OSError exception: [Errno 2] No such file or directory: 'xdpyinfo': 'xdpyinfo'
2020-01-06 18:53:18,308 - pyvirtualdisplay.abstractdisplay - WARNING - xdpyinfo was not found, X start can not be checked! Please install xdpyinfo!
2020-01-06 18:53:18,417 - selenium.webdriver.remote.remote_connection - DEBUG - POST http://10.51.161.41:1111/wd/hub/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "chrome", "platformName": "any", "goog:chromeOptions": {"prefs": {"profile.default_content_setting_values.notifications": 1}, "extensions": [], "args": ["--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream", "--no-sandbox", "--disable-dev-shm-usage"]}}}, "desiredCapabilities": {"browserName": "chrome", "version": "", "platform": "ANY", "loggingPrefs": {"browser": "ALL"}, "goog:chromeOptions": {"prefs": {"profile.default_content_setting_values.notifications": 1}, "extensions": [], "args": ["--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream", "--no-sandbox", "--disable-dev-shm-usage"]}}}
2020-01-06 18:53:18,433 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 10.51.161.41:1111
2020-01-06 18:53:20,106 - urllib3.connectionpool - DEBUG - http://10.51.161.41:1111 "POST /wd/hub/session HTTP/1.1" 200 1017
2020-01-06 18:53:20,107 - selenium.webdriver.remote.remote_connection - DEBUG - Finished Request

@ponty, as I understood the xdpyinfo not working?

from pyvirtualdisplay.

ponty avatar ponty commented on August 17, 2024

I added logging for xdpyinfo, please check with it.

from pyvirtualdisplay.

ratmirasanov avatar ratmirasanov commented on August 17, 2024

I see the following now:

Error
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.6_1/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_1/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 43, 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, xdpyinfo.stderr))
pyvirtualdisplay.abstractdisplay.XStartTimeoutError: Failed to start X on display ":1001" (xdpyinfo check failed, stderr:[xdpyinfo: unable to open display ":1001".]).

from pyvirtualdisplay.

ponty avatar ponty commented on August 17, 2024

I have no idea. This happens inside PyVirtualDisplay:

$ (Xvfb -br -nolisten tcp -screen 0 1366x768x24 :1001 &);sleep 0.1;DISPLAY=:1001 xdpyinfo 
name of display:    :1001
version number:    11.0
vendor string:    The X.Org Foundation
vendor release number:    12004000
X.Org version: 1.20.4
maximum request size:  16777212 bytes
motion buffer size:  256
bitmap unit, bit order, padding:    32, LSBFirst, 32
image byte order:    LSBFirst
number of supported pixmap formats:    6
...

from pyvirtualdisplay.

ratmirasanov avatar ratmirasanov commented on August 17, 2024

Ok, thanks anyway for your help. We have such a problem on any Mac (tested on several machines with XQuartz).
For now, we will use the old version of the package for Mac and the latest for our Linux machine. Or we can just remove xdpyinfo program on Mac (I think, it's better).

from pyvirtualdisplay.

ratmirasanov avatar ratmirasanov commented on August 17, 2024

@ponty, after running the following command:
(Xvfb -br -nolisten tcp -screen 0 1366x768x24 :1001 &);sleep 0.1;DISPLAY=:1001 xdpyinfo
I see:

_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
_XSERVTransSocketUNIXCreateListener: mkdir(/tmp/.X11-unix) failed, errno = 2
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
xdpyinfo: unable to open display ":1001".

from pyvirtualdisplay.

ratmirasanov avatar ratmirasanov commented on August 17, 2024

Yes, my problem is solved. Thanks!!

from pyvirtualdisplay.

Lakshmiaddepalli avatar Lakshmiaddepalli commented on August 17, 2024

Nice worked for me too!

from pyvirtualdisplay.

mutiev avatar mutiev commented on August 17, 2024

Yes, problem solved for macos xvfb problem.
Full info

brew install --cask xquartz
export PATH=$PATH:/opt/X11/bin >> .zshrc

mkdir /tmp/.X11-unix
sudo chmod 1777 /tmp/.X11-unix
sudo chown root /tmp/.X11-unix/

from pyvirtualdisplay.

Related Issues (20)

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.