@@ -13788,31 +13788,33 @@ def __activate_virtual_display_as_needed(self):
13788
13788
which is the default mode on Linux unless using another arg."""
13789
13789
if "linux" in sys.platform and (not self.headed or self.xvfb):
13790
13790
from sbvirtualdisplay import Display
13791
- if self.undetectable and not (self.headless or self.headless2):
13792
- import Xlib.display
13793
- try:
13794
- self._xvfb_display = Display(
13795
- visible=True,
13796
- size=(1366, 768),
13797
- backend="xvfb",
13798
- use_xauth=True,
13799
- )
13800
- self._xvfb_display.start()
13801
- if "DISPLAY" not in os.environ.keys():
13791
+ pip_find_lock = fasteners.InterProcessLock(
13792
+ constants.PipInstall.FINDLOCK
13793
+ )
13794
+ with pip_find_lock: # Prevent issues with multiple processes
13795
+ if self.undetectable and not (self.headless or self.headless2):
13796
+ import Xlib.display
13797
+ try:
13798
+ self._xvfb_display = Display(
13799
+ visible=True,
13800
+ size=(1366, 768),
13801
+ backend="xvfb",
13802
+ use_xauth=True,
13803
+ )
13804
+ self._xvfb_display.start()
13805
+ if "DISPLAY" not in os.environ.keys():
13806
+ print(
13807
+ "\nX11 display failed! Will use regular xvfb!"
13808
+ )
13809
+ self.__activate_standard_virtual_display()
13810
+ except Exception as e:
13811
+ if hasattr(e, "msg"):
13812
+ print("\n" + str(e.msg))
13813
+ else:
13814
+ print(e)
13802
13815
print("\nX11 display failed! Will use regular xvfb!")
13803
13816
self.__activate_standard_virtual_display()
13804
- except Exception as e:
13805
- if hasattr(e, "msg"):
13806
- print("\n" + str(e.msg))
13807
- else:
13808
- print(e)
13809
- print("\nX11 display failed! Will use regular xvfb!")
13810
- self.__activate_standard_virtual_display()
13811
- return
13812
- pip_find_lock = fasteners.InterProcessLock(
13813
- constants.PipInstall.FINDLOCK
13814
- )
13815
- with pip_find_lock: # Prevent issues with multiple processes
13817
+ return
13816
13818
pyautogui_is_installed = False
13817
13819
try:
13818
13820
import pyautogui
@@ -13854,8 +13856,8 @@ def __activate_virtual_display_as_needed(self):
13854
13856
print("\n" + str(e.msg))
13855
13857
else:
13856
13858
print(e)
13857
- else:
13858
- self.__activate_standard_virtual_display()
13859
+ else:
13860
+ self.__activate_standard_virtual_display()
13859
13861
13860
13862
def __ad_block_as_needed(self):
13861
13863
"""This is an internal method for handling ad-blocking.
0 commit comments