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

OSError - %1 is not a valid Win32 application #16

Open
sbi-rviot opened this issue Jan 21, 2020 · 3 comments
Open

OSError - %1 is not a valid Win32 application #16

sbi-rviot opened this issue Jan 21, 2020 · 3 comments

Comments

@sbi-rviot
Copy link

I am running the basic example as follow:

import pydf
pdf = pydf.generate_pdf('<h1>this is html</h1>')
with open('test_doc.pdf', 'wb') as f:
    f.write(pdf)

and I get the following error:

Traceback (most recent call last):
  File "pdytest.py", line 2, in <module>
    pdf = pydf.generate_pdf('<h1>this is html</h1>')
  File "C:\Program Files\Python37\lib\site-packages\pydf\wkhtmltopdf.py", line 145, in generate_pdf
    p = _execute_wk(*cmd_args, input=html.encode())
  File "C:\Program Files\Python37\lib\site-packages\pydf\wkhtmltopdf.py", line 30, in _execute_wk
    return subprocess.run(wk_args, input=input, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "C:\Program Files\Python37\lib\subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Program Files\Python37\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Program Files\Python37\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application

I am using python 3.7.
Could you please help?
Thank you.

@samuelcolvin
Copy link
Member

I'm afraid I don't run windows so can't fix this directly.

I suspect it's related to the path separator in the executor path.

If you can fix, happy to accept a PR.

@vapavlov
Copy link

vapavlov commented Jul 5, 2021

I have the same issue on Windows. If someone could fix it it would be great.

@davilos
Copy link

davilos commented Feb 22, 2022

1 - here
image
2 - WKHTMLTOPDF_PATH / C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe
image
3- and reset your computer

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

4 participants