html2image icon indicating copy to clipboard operation
html2image copied to clipboard

Screenshot image not getting created in ubuntu server

Open gmehta1996 opened this issue 2 years ago • 0 comments

Hi I am trying to run a script where I'm creating a png image with html but getting the following error: mkdir: cannot create directory ‘/run/user/0’: Permission denied [1021/052947.190152:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable. [1021/052947.261096:WARNING:sandbox_linux.cc(380)] InitializeSandbox() called with multiple threads in process gpu-process. [1021/052947.504123:ERROR:headless_shell.cc(634)] Writing to file /home/ubuntu/.../screenshot.png was unsuccessful, could not open file: FILE_ERROR_ACCESS_DENIED I'm running this through the root user Following is the code I'm using:

hti = Html2Image( custom_flags=["--no-sandbox","--default-background-color=1"] ) hti.screenshot(html_str=response_html, save_as=image_name) I also tried "--disable-gpu", in the custom flags but still getting the same error What should be the correct solution for this. Thanks

gmehta1996 avatar Oct 21 '22 05:10 gmehta1996