Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python wkhtmltopdf can't import module

I am using Python version 3.6, Django version 1.9 and wkhtmltopdf version 0.2. My Python is not GCC it's Anaconda3.

When running my project which uses wkhtmltopdf, following error will be thrown:

from main import WKhtmlToPdf, wkhtmltopd
ModuleNotFoundError: No module named 'main'

This is how I imported the wkhtmltopdf:

import pdfkit
from wkhtmltopdf.views import PDFTemplateView

2 Answers

Yes i got the answer. This error occurred because i didn't installed django-wkhtmltopdf. installed >> `pip install django-wkhtmltopdf

I hope this answer will help to resolve the similar error.

after installing pdfkit with following command and pointing python version 3.8, i was able to get pdfkit working on mac

pip3 install pdfkit
like image 41
Vijay Avatar answered Sep 26 '26 01:09

Vijay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!