Skip to content

Commit a18cd3a

Browse files
kalkehcoisalukeis
authored andcommitted
FileExistsError when trying to reuse FirefowProfile
I've been getting the following error while trying to reuse a cached FirefowProfile: File "autominer/mine.py", line 20, in __init__ self.driver = webdriver.Firefox(firefox_profile=ffprofile) File "/var/virtual_envs/autominer/lib/python3.4/site-packages/selenium/webdriver/firefox/webdriver.py", line 77, in __init__ self.binary, timeout), File "/var/virtual_envs/autominer/lib/python3.4/site-packages/selenium/webdriver/firefox/extension_connection.py", line 49, in __init__ self.binary.launch_browser(self.profile) File "/var/virtual_envs/autominer/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 67, in launch_browser self._start_from_profile_path(self.profile.path) File "/var/virtual_envs/autominer/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 83, in _start_from_profile_path self._modify_link_library_path() File "/var/virtual_envs/autominer/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 175, in _modify_link_library_path self.profile, self.NO_FOCUS_LIBRARY_NAME, "x86", "amd64") File "/var/virtual_envs/autominer/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 189, in _extract_and_check os.makedirs(library_path) File "/var/virtual_envs/autominer/lib/python3.4/os.py", line 237, in makedirs mkdir(name, mode) FileExistsError: [Errno 17] File exists: '/tmp/tmpd3gzuv8g/webdriver-py-profilecopy/x86' I just added a line checking if the directory exists before trying to create it to the code.Tthe problem is gone here. Signed-off-by: Luke Inman-Semerau <[email protected]>
1 parent 5beafb1 commit a18cd3a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

py/selenium/webdriver/firefox/firefox_binary.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ def _extract_and_check(self, profile, no_focus_so_name, x86, amd64):
185185
built_path = ""
186186
for path in paths:
187187
library_path = os.path.join(profile.path, path)
188-
os.makedirs(library_path)
188+
if not os.path.exists(library_path):
189+
os.makedirs(library_path)
189190
import shutil
190191
shutil.copy(os.path.join(os.path.dirname(__file__), path,
191192
self.NO_FOCUS_LIBRARY_NAME),

0 commit comments

Comments
 (0)