File tree 2 files changed +23
-0
lines changed
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):
97
97
print (message )
98
98
99
99
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
+
100
107
def make_executable (file_path ):
101
108
# Set permissions to: "If you can read it, you can execute it."
102
109
mode = os .stat (file_path ).st_mode
@@ -815,6 +822,13 @@ def install_pyautogui_if_missing(driver):
815
822
pip_find_lock = fasteners .InterProcessLock (
816
823
constants .PipInstall .FINDLOCK
817
824
)
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 )
818
832
with pip_find_lock : # Prevent issues with multiple processes
819
833
try :
820
834
import pyautogui
Original file line number Diff line number Diff line change @@ -13983,6 +13983,15 @@ def __activate_virtual_display_as_needed(self):
13983
13983
pip_find_lock = fasteners.InterProcessLock(
13984
13984
constants.PipInstall.FINDLOCK
13985
13985
)
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)
13986
13995
with pip_find_lock: # Prevent issues with multiple processes
13987
13996
if self.undetectable and not (self.headless or self.headless2):
13988
13997
import Xlib.display
You can’t perform that action at this time.
0 commit comments