pydf
pydf copied to clipboard
OSError - %1 is not a valid Win32 application
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.
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.
I have the same issue on Windows. If someone could fix it it would be great.
1 - here
2 - WKHTMLTOPDF_PATH / C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe
3- and reset your computer