-
Notifications
You must be signed in to change notification settings - Fork 162
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
How to use webscreenshot from inside a python script? #19
Comments
Hello, You indeed need to call that function. Cheers. |
Hello, Here below a more precise answer:
I admit that this use case deserves a better approach. Cheers |
For the reference, I maintain an updated version of the correct code in the FAQ |
I'm getting this error on using the above code snippet `[+] 2 URLs to be screenshot The above exception was the direct cause of the following exception: Traceback (most recent call last): |
@ss2sfcollege, have you followed indications. |
Hello, I'm getting the following error if executed the above program: C:\Users\sandeep\PycharmProjects\sparkflow_validation\venv\Scripts\python.exe C:/Users/sandeep/PycharmProjects/sparkflow_validation/take_screenshot.py
The same error is getting in a loop and the program is not terminating |
@poornasandeep can you paste here the code you are using to call webscreenshot ? |
@maaaaz I am getting the same error as @poornasandeep. Here is the code I am using (taken from the FAQ): import argparse
from webscreenshot.webscreenshot import *
url_list = ['http://google.com']
options = argparse.Namespace(URL=None, cookie=None, header=None, http_password=None, http_username=None, input_file=None, log_level='DEBUG', multiprotocol=False, no_xserver=False, output_directory='./screenshots', port=None, proxy=None, proxy_auth=None, proxy_type=None, renderer='phantomjs', renderer_binary=None, ssl=False, timeout=30, verbosity=2, window_size='1200,800', workers=4)
take_screenshot(url_list, options) It does not terminate and it keeps printing I am using Python 3.8.3 on Windows 10 (2004 update), with version 2.92 of the webscreenshot package. Here is the error stack
|
Thanks for reporting, it seems related to the way Python 3.8 now behaves with multiprocessing. I think that the pool creation (that line) should be moved to the In the meantime, try to execute your code with Python 3.7 and not 3.8. |
I confirm that bug, I tried to fix it but unfortunately failed so far in front of this madness. I do understand the technical reasons, but I regret that users calling |
An alternative would be to run it as a subprocess which seems to be working fine for me on Python 3.8:
|
The documentation states:
pip install webscreenshot and then directly use webscreenshot
How does one directly use webscreenshot?
My python script contains:
Now, how do I call webscreenshot directly from the script? The documentation doesn't provide any examples. It does for calling the script from the commandline and passing arguments, but I want to call it directly from inside my python script.
webscreenshot.take_screenshot(list_of_urls)
doesn't seem to work.The text was updated successfully, but these errors were encountered: