0

I need to run this script from the web, but when I try to run it, I get:

`

  File "/var/www/StockCheck/include/sel.py", line 15, in <module>
    options = uc.ChromeOptions()
  File "/usr/local/lib/python3.8/dist-packages/undetected_chromedriver/__init__.py", line 116, in __new__
    ChromeDriverManager(*args, **kwargs).install()
  File "/usr/local/lib/python3.8/dist-packages/undetected_chromedriver/__init__.py", line 195, in install
    self.fetch_chromedriver()
  File "/usr/local/lib/python3.8/dist-packages/undetected_chromedriver/__init__.py", line 227, in fetch_chromedriver
    urlretrieve(
  File "/usr/lib/python3.8/urllib/request.py", line 257, in urlretrieve
    tfp = open(filename, 'wb')
PermissionError: [Errno 13] Permission denied: 'chromedriver.zip'

`

From root, everything is OK. And I can't even determine where the script downloads chromedriver. Help me please!

My script is:


    import undetected_chromedriver as uc
    from pyvirtualdisplay import Display
    
    
    import os
    import time
    import sys
    
    if os.environ.get("USER") and os.environ.get("USER") == "www-data":
        os.environ["HOME"] = "/tmp/www_fake_home/"
    
    display = Display(visible=0, size=(1920, 1080))
    display.start()
    
    options = uc.ChromeOptions()
    options.add_argument('start-maximized')
    options.add_argument('--headless')
    options.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36")
    options.add_argument("--no-sandbox")
    browser = uc.Chrome(options=options)
    url = sys.argv[1]
    browser.get(url)
    print(browser.page_source)
    browser.quit()

Thanks in advance!

KovMus
  • 31
  • 8

0 Answers0