I the docs you can see an example, but in your shared code I dont see nothing like that example.
Maybe you use this guide, in that case you need to set the correct encondig because by default the library take this based from the HTML header data, something like this:
I don't know what else i can do... im going to install Deepin 15.9 on my server to try WeasyPrint again. :S but i know that ins't a good deployment practice :S
You use pip3 but when you run the Django app what version are you using ? Maybe the xhtml2pdf in your app was taken from the python2 packages folder...
My advice is you need to use virtualenv or maybe the venv built-in module in >= python3.3 and with that you ensure the packages installed via pip and the version is the correct.
Can you give us a complete traceback in text format (not a screenshot) ? It's hard to debug otherwise. I just tried to install WeasyPrint without issues (but I'm on a macOS, not Linux), which makes me think there's either something weird going on with the steps you're taking or you're missing some key library that the Python packages need.
The issue in the link seems related to network problems, sometimes you just need to re-issue a command.
Let's start from the beginning: installing WeasyPrint.
this way you know you're using an isolated version of pip. Then you can issue pip install weasyprint and pip install https://github.com/xhtml2pdf/xhtml2pdf/archive/master.zip
If you're still having problems then you'll know there's something missing and you can open an issue to xhtml2pdf or whichever package blows up during installation.
@rhymes
: The problem was that Cairocffi was installed badly, when one consulted through pip freeze the version showed something strange about the version.
But when trying to install version 1.0.1 I got a network error, reading on the internet I discovered that others had the same error so I upgraded my pip to its latest version and then install Cairocffi == 1.0.1.
Now I only have a Warning from WeasyPrint saying that I am using a lower version than the one required in Cairo and that this can bring rendering problems.
Try the app and render me well what I need, so for now I will ignore that Warning, I do not want to break that hahahaha again.
Many thanks to all who helped me, I really appreciate it that you have spent part of your precious time in me.
: D
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
What version of
xhtml2pdf
are you using ?I the docs you can see an example, but in your shared code I dont see nothing like that example.
Maybe you use this guide, in that case you need to set the correct encondig because by default the library take this based from the HTML header data, something like this:
But if your HTML file is UTF8 you need to encode that and pass the correct encoding argument to
pisaDocument
.I'm using xhtml2pdf version 0.2.3.
Still getting
NotImplementedType object its not iterable
This gonna make me crazy guys..
Could be a bug in the
xhtml2pdf
library.But if you go to the master branch you can see the correct lines
So just install directly from Github:
I'll try this next mon. Right now i can't download files. Thanks a lot @Kip
thepracticaldev.s3.amazonaws.com/i...
I've installed it but same error.... :(
I don't know what else i can do... im going to install Deepin 15.9 on my server to try WeasyPrint again. :S but i know that ins't a good deployment practice :S
You use
pip3
but when you run the Django app what version are you using ? Maybe thexhtml2pdf
in your app was taken from thepython2
packages folder...My advice is you need to use
virtualenv
or maybe the venv built-in module in>= python3.3
and with that you ensure the packages installed via pip and the version is the correct.Dead Simple Python: Virtual Environments and pip
Jason C. McDonald
How i know what version use? i suppose that if Django 2.0.6 uses Python3 then xhtml2pdf uses the same.
Today i tried to install WeasyPrint again but:
dev.to/dcruz1990/weasyprint-imposs...
Can you give us a complete traceback in text format (not a screenshot) ? It's hard to debug otherwise. I just tried to install WeasyPrint without issues (but I'm on a macOS, not Linux), which makes me think there's either something weird going on with the steps you're taking or you're missing some key library that the Python packages need.
The issue in the link seems related to network problems, sometimes you just need to re-issue a command.
Let's start from the beginning: installing WeasyPrint.
Using pip directly it works:
The same happened with xhtml2pdf:
So now that we've established it could work, we know that there are three main factors at play:
Can you isolate the problem?
Create a virtualenv:
this way you know you're using an isolated version of pip. Then you can issue
pip install weasyprint
andpip install https://github.com/xhtml2pdf/xhtml2pdf/archive/master.zip
If you're still having problems then you'll know there's something missing and you can open an issue to xhtml2pdf or whichever package blows up during installation.
Let me know!
@rhymes : The problem was that Cairocffi was installed badly, when one consulted through pip freeze the version showed something strange about the version.
But when trying to install version 1.0.1 I got a network error, reading on the internet I discovered that others had the same error so I upgraded my pip to its latest version and then install Cairocffi == 1.0.1.
Now I only have a Warning from WeasyPrint saying that I am using a lower version than the one required in Cairo and that this can bring rendering problems.
Try the app and render me well what I need, so for now I will ignore that Warning, I do not want to break that hahahaha again.
Many thanks to all who helped me, I really appreciate it that you have spent part of your precious time in me.
: D