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

PermissionError: [Errno 13] Permission denied: b'' #25

Closed
Houwarnick opened this issue May 17, 2018 · 5 comments
Closed

PermissionError: [Errno 13] Permission denied: b'' #25

Houwarnick opened this issue May 17, 2018 · 5 comments

Comments

@Houwarnick
Copy link

>>> import imgkit
>>> html = "\n  <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,300,400,600\" type=\"text/css\" media=\"all\" />\n  <style type=\"text/css\" media=\"all\">\n    html {\n      font-size: 62.5%;\n      box-sizing: border-box;\n    }\n    body {\n      margin: 0;\n      padding: 0;\n      font-size:10pt;\n      line-height: 1.5;\n      box-sizing: border-box;\n      font-family: \"Open Sans\", arial, sans-serif;\n    }\n    p, div {\n      margin: 0;\n      min-height: 18px;\n      box-sizing: border-box;\n    }\n    ol, ul {\n      margin: 0;\n    }\n  </style>\n  <p>asdgfa<span style='color: #0D73D9;'>asdfasdfasdfasdfasdgasdfa</span><span style='color: #E51515;'>sadasdfa</span><span style='font-size: 14pt;'><span style='color: #E51515;'>asdgasdf</span><span style='color: #FCB104;'>asdgasdfasdfhasdf</span></span></p><p><span style='font-size: 14pt;'><span style='color: #A742FF;'>PURPLE TEXT IS IMPORTANT</span></span></p>"
>>> options = {'format': 'png', 'xvfb': ''}
>>> test = imgkit.from_string(html, False, options=options)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/houstonwarnick/.local/share/virtualenvs/letter-service-eh0o3bg_/lib/python3.6/site-packages/imgkit/api.py", line 90, in from_string
    return rtn.to_img(output_path)
  File "/Users/houstonwarnick/.local/share/virtualenvs/letter-service-eh0o3bg_/lib/python3.6/site-packages/imgkit/imgkit.py", line 213, in to_img
    stderr=subprocess.PIPE)
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: b''

I've been able to get it working with my local macOS environment without using xvfb, but once I try in an AlpineLinux environment that requires xvfb I get this error. I can reproduce the error with my local environment by using the xvfb flag there.

@parthasaradhikonda
Copy link

Any update on this?

@mike1703
Copy link
Contributor

this is the reason for the issue: https://bugs.alpinelinux.org/issues/9617
In config.py the xvfb-run command is not found and therefore b'' is stored. You cannot execute the empty string.

A possible solution until xvfb-run is packaged in alpine is to add the file manually (the one from here works for example: https://github.com/cjpetrus/alpine_webkit2png)

There should be some error handling code if no executable is found to assist in the debugging.

@mike1703
Copy link
Contributor

opened pull request #33 to have better error handling which shows an error if xvfb-run is not available

@klauskades
Copy link

Just as a short update in case sombody still hast the problem. In my case installing xvfb in Ubuntu 20.04 resolved the issue:

sudo apt-get install xvfb

@jarrekk
Copy link
Owner

jarrekk commented Mar 18, 2021

PermissionError: [Errno 13] Permission denied: b''

This error is caused by not found xvfb-run, so b'' means the final xvfb-run path. Fixed in https://github.com/jarrekk/imgkit/blob/V1.1.0/imgkit/config.py

@jarrekk jarrekk closed this as completed Mar 23, 2021
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

5 participants