File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,13 @@ def log_d(message):
9797 print (message )
9898
9999
100+ def make_writable (file_path ):
101+ # Set permissions to: "If you can read it, you can write it."
102+ mode = os .stat (file_path ).st_mode
103+ mode |= (mode & 0o444 ) >> 1 # copy R bits to W
104+ os .chmod (file_path , mode )
105+
106+
100107def make_executable (file_path ):
101108 # Set permissions to: "If you can read it, you can execute it."
102109 mode = os .stat (file_path ).st_mode
@@ -815,6 +822,13 @@ def install_pyautogui_if_missing(driver):
815822 pip_find_lock = fasteners .InterProcessLock (
816823 constants .PipInstall .FINDLOCK
817824 )
825+ try :
826+ with pip_find_lock :
827+ pass
828+ except Exception :
829+ # Need write permissions
830+ with suppress (Exception ):
831+ make_writable (constants .PipInstall .FINDLOCK )
818832 with pip_find_lock : # Prevent issues with multiple processes
819833 try :
820834 import pyautogui
Original file line number Diff line number Diff line change @@ -13983,6 +13983,15 @@ def __activate_virtual_display_as_needed(self):
1398313983 pip_find_lock = fasteners.InterProcessLock(
1398413984 constants.PipInstall.FINDLOCK
1398513985 )
13986+ try:
13987+ with pip_find_lock:
13988+ pass
13989+ except Exception:
13990+ # Need write permissions
13991+ with suppress(Exception):
13992+ mode = os.stat(constants.PipInstall.FINDLOCK).st_mode
13993+ mode |= (mode & 0o444) >> 1 # copy R bits to W
13994+ os.chmod(constants.PipInstall.FINDLOCK, mode)
1398613995 with pip_find_lock: # Prevent issues with multiple processes
1398713996 if self.undetectable and not (self.headless or self.headless2):
1398813997 import Xlib.display
You can’t perform that action at this time.
0 commit comments