Python error: No handlers could be found for logger “xhtml2pdf”

0 votes

I am converting an HTML to pdf in django function, for this i am using xhtml2pdf pisa module, and the code is

pdf = pisa.CreatePDF(html, file(settings.MEDIA_ROOT+'/tickets_pdf/'+pdfName, "w"))

This code is working and generates pdf but sometime it works and sometime it doesn't work and give error

No handlers could be found for logger “xhtml2pdf”

There is also same question on SO that I have already checked.

No handlers could be found for logger "xhtml2pdf"

But it did not work for me. If my client generates 10 times pdf then at least 4 times it gives this error and in other case it works fine. Is there any solution for this, or i have to generate pdf in other way.

Sep 5, 2018 in Python by bug_seeker
• 14,980 points
115 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
The only solution is to define a handler for xhtml2pdf in your settings file, as suggested by provided link.

The reason you get 500 error is because you have defined logger wrong. Check the app logs for errors, check the path to the log file that you have defined in settings.
answered Sep 5, 2018 by Priyaj
• 56,140 points

Related Questions In Python

0 votes
1 answer

Which IDE can be used for Python on Mac OS X

Have tried many different (Kate, Eclipse, Scite, ...READ MORE

answered Oct 15, 2018 in Python by SDeb
• 10,780 points
41 views
0 votes
1 answer

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

The following are totally acceptable in python: passing ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,500 points
5,762 views
0 votes
1 answer

how to download and install Django rest framework?

To install Django, you can simply open ...READ MORE

answered Apr 24, 2018 in Python by Christine
• 15,790 points
89 views
0 votes
1 answer
0 votes
1 answer

Host not allowed

Go to your project directory cd project cd project ALLOWED_HOSTS ...READ MORE

answered Aug 9, 2018 in AWS by Priyaj
• 56,140 points
74 views
0 votes
1 answer

'Syntax Error: invalid syntax' for no apparent reason

You're missing a close paren in this ...READ MORE

answered Aug 13, 2018 in Python by Priyaj
• 56,140 points
47 views
0 votes
1 answer

What is the flow control for “continue” in python?

This is the way "continue" statement works! You ...READ MORE

answered Jul 16, 2018 in Python by Priyaj
• 56,140 points
42 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.