PyVirtualDisplay icon indicating copy to clipboard operation
PyVirtualDisplay copied to clipboard

Cant instantiate Display()

Open wizit opened this issue 2 years ago • 3 comments

When i try to use pyvritualdisplay and call Display() it gives me the following error Traceback (most recent call last): File "test.py", line 5, in <module> disp = Display() File "C:\Users\cvssh\PycharmProjects\Trustmenot2\venv\lib\site-packages\pyvirtualdisplay\display.py", line 54, in __init__ self._obj = cls( File "C:\Users\cvssh\PycharmProjects\Trustmenot2\venv\lib\site-packages\pyvirtualdisplay\xvfb.py", line 44, in __init__ AbstractDisplay.__init__( File "C:\Users\cvssh\PycharmProjects\Trustmenot2\venv\lib\site-packages\pyvirtualdisplay\abstractdisplay.py", line 85, in __init__ helptext = get_helptext(program) File "C:\Users\cvssh\PycharmProjects\Trustmenot2\venv\lib\site-packages\pyvirtualdisplay\util.py", line 13, in get_helptext p = subprocess.Popen( File "C:\Users\cvssh\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\cvssh\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

wizit avatar Mar 15 '22 22:03 wizit

Have you installed Xvfb?

ponty avatar Apr 02 '22 09:04 ponty

Have you installed Xvfb?

Windows cant install Xvfb. How to use it on Windows ? I got the same error. Thank you.

zerolimits303 avatar Apr 23 '22 05:04 zerolimits303

I have no idea how to install Xvfb on Windows, ask it on a Xvfb forum. This forum is for the Python wrapper.

ponty avatar Apr 24 '22 20:04 ponty

@ponty is it possible for you to make a check condition Example: if pyvritualdisplay.is_ready

Just to check if virtual display is installed and ready to be used, because in production I use selenium inside linux docker image to run the python script but I run the scripts for testing and dev on windows so If I had something like this I could make it so that when virtual display is available it can use it.

modbender avatar Nov 24 '22 19:11 modbender