user9088612
user9088612

Reputation:

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

Upvotes: 3

Views: 2945

Answers (2)

Vijay
Vijay

Reputation: 143

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

pip3 install pdfkit

Upvotes: 2

user9088612
user9088612

Reputation:

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.

Upvotes: 3

Related Questions