From dc8493de6329454b09401f90d315c4ad1f966ae6 Mon Sep 17 00:00:00 2001 From: mike <219478+ilude@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:37:30 -0400 Subject: [PATCH] once more with feeling --- app/app.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/app.py b/app/app.py index a9d3eb7..7411e2e 100644 --- a/app/app.py +++ b/app/app.py @@ -6,15 +6,19 @@ app = Flask(__name__) -# Create a headless browser instance -options = webdriver.ChromeOptions() -options.add_argument('--no-sandbox') -options.add_argument('--headless') -options.add_argument('--disable-gpu') -options.add_argument('--disable-dev-shm-usage') -options.add_argument('--profile-directory=Default') -options.add_argument('--user-data-dir=~/.config/google-chrome') -driver = webdriver.Chrome(options=options) +try: + os.makedirs('app/static/screenshots') + # Create a headless browser instance + options = webdriver.ChromeOptions() + options.add_argument('--no-sandbox') + options.add_argument('--headless') + options.add_argument('--disable-gpu') + options.add_argument('--disable-dev-shm-usage') + options.add_argument('--profile-directory=Default') + options.add_argument('--user-data-dir=~/.config/google-chrome') + driver = webdriver.Chrome(options=options) +except Exception as e: + print(f"Error creating headless browser: {str(e)}") def expand_url(url): try: