Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find chrome #15

Closed
em-mw opened this issue May 24, 2023 · 1 comment
Closed

Cannot find chrome #15

em-mw opened this issue May 24, 2023 · 1 comment

Comments

@em-mw
Copy link

em-mw commented May 24, 2023

Whenever I try to run the program I get this error message occasionally. I suspect this means that puppeteer cannot find chrome. I have updated my singlefile.py file to include these lines:

from subprocess import run

SINGLEFILE_BINARY_PATH = "./node_modules/single-file/cli/single-file"
CHROME_PATH = "/opt/google/chrome/google-chrome" #Uncomment this and set your browser exe if it can't find yours.

def addQuotes(str):
    return "\"" + str.strip("\"") + "\""

def download_page(url, cookies_path, output_path, output_name_template = ""):
    args = [
        addQuotes(SINGLEFILE_BINARY_PATH),
        #"--browser-executable-path=" + addQuotes(CHROME_PATH.strip("\"")), #Uncomment this and set your browser exe if it can't find yours.
        "--browser-cookies-file=" + addQuotes(cookies_path),
        "--output-directory=" + addQuotes(output_path),
        addQuotes(url)
        ]

    if(output_name_template != ""):
        args.append("--filename-template=" + addQuotes(output_name_template))

    try:
        run("node " + " ".join(args), shell=True)
    except Exception as e:
        print("Was not able to save the URL " + url + " using singlefile. The reported error was " + e.strerror)

if __name__ == "__main__":
    download_page("https://www.google.com/", "", "./output/test", "test.html")

(I changed the file location of the chrome bin)

after doing this I still get the error message. I don't know if I am doing anything wrong.

@em-mw
Copy link
Author

em-mw commented May 24, 2023

Nevermind

@em-mw em-mw closed this as completed May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant