I have a script (a scraping script using the firefox driver) that works perfectly fine if I run it from a bash console with the correct virtualenv activated.
Up until friday the 21st, this was also working for several years as a scheduled task. I run it within the venv like so:
/home/tsgamingllc/venvtask/bin/python /home/tsgamingllc/tsgamingdjango/project-python-django-webapp-master/newscrape.py
Now suddenly starting on friday the scheduled task receives this error below. Once again, running this same exact script from the console (with venvtask active) works perfectly fine.
Traceback (most recent call last):
File "/home/tsgamingllc/tsgamingdjango/project-python-django-webapp-master/newscrape.py", line 51, in fetch
browser = webdriver.Firefox(profile)
File "/home/tsgamingllc/venvtask/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 80, in __init__
self.binary, timeout)
File "/home/tsgamingllc/venvtask/lib/python3.6/site-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "/home/tsgamingllc/venvtask/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "/home/tsgamingllc/venvtask/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 108, in _wait_until_connectable
% (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: /tmp/tmpvqatr4sw If you specified a log_file in the FirefoxBinary constructor, check it for details.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/tsgamingllc/tsgamingdjango/project-python-django-webapp-master/newscrape.py", line 256, in <module>
fetch()
File "/home/tsgamingllc/tsgamingdjango/project-python-django-webapp-master/newscrape.py", line 56, in fetch
browser = webdriver.Firefox(profile)
File "/home/tsgamingllc/venvtask/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 60, in __init__
capabilities.update(self.options.to_capabilities())
File "/home/tsgamingllc/venvtask/lib/python3.6/site-packages/selenium/webdriver/firefox/options.py", line 93, in to_capabilities
desired["firefox_profile"] = self._profile.encoded
File "/home/tsgamingllc/venvtask/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_profile.py", line 175, in encoded
zipped.write(filename, filename[path_root:])
File "/usr/lib/python3.6/zipfile.py", line 1617, in write
zinfo = ZipInfo.from_file(filename, arcname)
File "/usr/lib/python3.6/zipfile.py", line 507, in from_file
st = os.stat(filename)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpvqatr4sw/lock'
2022-10-23 13:06:27 -- Completed task, took 373.83 seconds, return code was 1.