Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-01-2011, 10:23 PM   #1
kleinfelter
Junior Member
kleinfelter began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jan 2011
Device: Kindle
AttributeError: 'PDFWriter' object has no attribute 'get_printer'

When I attempt to convert to PDF, I receive the error:
AttributeError: 'PDFWriter' object has no attribute 'get_printer'

I received the same result when attempting to convert a (non-DRM) EPUB and a (non-DRM) MOBI.

I'm running calibre version 0.7.36, on Windows XP SP3. I do not currently have a Python installed on this PC.

Is there a work-around available?
TIA
kleinfelter is offline   Reply With Quote
Old 01-01-2011, 11:13 PM   #2
quixote
Junior Member
quixote began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2011
Device: none (Kindle?)
Same problem

I was using 7.12, trying to convert epub to pdf. It kept giving me zero length files. I found the newest version, 7.36, with the handy install command for Linux (Thanks! ), and tried again.

I get the same error message as klinefelter. The progress bar at job info stays stuck at 67%.

I tried converting an html to pdf, but all it does is put the <h2>header in a table-of-contents, but there are no contents. The job says it's 100% completed.

I have python 2.6. I don't remember the dependencies too well, but I did read through them and I'm pretty sure I have them all.

The other error message I've gotten is a refusal to display because it's a DRM'ed file. This is my own writing, and I certainly haven't been aware of DRMing anything. I don't remember the exact circumstances that time. I've been trying things, one after the other and not taking notes ...

but I see the perfect smilie over there ...
quixote is offline   Reply With Quote
Advert
Old 01-02-2011, 09:58 AM   #3
kleinfelter
Junior Member
kleinfelter began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jan 2011
Device: Kindle
I Think I See The Problem and a Sometimes Work-around

When converting a book without a cover in the source file, setting the "Use cover from source file" option creates a PDF without a cover, and without an error. Sadly, when converting a book WITH a cover in the source file, setting this option does not improve the situation.

It looks to me like src/calibre/ebooks/pdf/writer.py has a bug in insert_cover (line 174 in the downloaded source), where
Code:
    printer = self.get_printer()
should be
Code:
    printer = get_pdf_printer(self.opts)
kleinfelter is offline   Reply With Quote
Old 01-02-2011, 10:00 AM   #4
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
It's a bug and there is no way around it. I've corrected it in my branch. Should make it into the next release.
user_none is offline   Reply With Quote
Old 01-02-2011, 10:28 AM   #5
kleinfelter
Junior Member
kleinfelter began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jan 2011
Device: Kindle
Work-around

Since I'm using Windows, I had to read up on how to use CALIBRE_DEVELOP_FROM before I could work around it. For other Calibre newbies (and those who just want to *use* Calibre), here's how to work-around this issue:
  1. Download calibre source from http://sourceforge.net/projects/cali...ar.gz/download
  2. Unpack the file (using a tool such as 7-zip).
  3. Move the "src" folder from where you unpacked the source into "C:\Program Files\Calibre" (assuming that you installed Calibre into "C:\Program Files\Calibre").
  4. Set the CALIBRE_DEVELOP_FROM environment variable to "C:\Program Files\Calibre\src"
  5. Edit C:\Program Files\Calibre\src\calibre\ebooks\pdf\writer.py
  6. Change the line which says "printer = self.get_printer()" to say "printer = get_pdf_printer(self.opts)"
  7. Run calibre
kleinfelter is offline   Reply With Quote
Advert
Old 01-02-2011, 05:22 PM   #6
quixote
Junior Member
quixote began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2011
Device: none (Kindle?)
Kudos!

You folks are the best! :

I can't wait to get this working. I run ubuntu, so I'm trying to transpose to that system, but I'm a bit too ignorant. I'm not sure I'm setting the environment variable right. I've tried at the command line as user and as root. It doesn't show up when I say "printenv" so I assume I've done something wrong. This is what I tried:
Code:
$CALIBRE_DEVELOP_FROM=/opt/calibre/src/
or
Code:
$sudo CALIBRE_DEVELOP_FROM=/opt/calibre/src/
or after getting a plain root shell:
Code:
#CALIBRE_DEVELOP_FROM=/opt/calibre/src/
/opt/calibre/src is the path to the source files I downloaded, after following the link. root has ownership of all the calibre directories in /opt/calibre/ and they are all executable.

What should I be doing different?
quixote is offline   Reply With Quote
Old 01-02-2011, 05:43 PM   #7
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
export CALIBRE_DEVELOP_FROM=/opt/calibre/src/

Also you will want to have the source files owned by your user. It would be better to have it some place in your home directory instead of opt.
user_none is offline   Reply With Quote
Old 01-02-2011, 05:55 PM   #8
quixote
Junior Member
quixote began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2011
Device: none (Kindle?)
Thanks for that info. Yeah, I see, after a better search that I was doing the env var all wrong. I made the changes, but they require a reboot to take effect, and my machine is in the process of doing a huge backup. Once that's done and I can reboot (some time tomorrow??), I'll come back and report on progress.

So, if I understand right, I could just set the env var to point to the location of the source files in my /home, even though the program itself is in /opt/calibre/ ? I.e. for instance
Code:
export CALIBRE_DEVELOP_FROM=/home/quixote/dwnlds/calibre/src
Thanks!
quixote is offline   Reply With Quote
Old 01-02-2011, 05:57 PM   #9
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by quixote View Post
I made the changes, but they require a reboot to take effect...
Not necessarily. If you added it to your bashrc (or bash_profile) file you don't need to reboot. Just open a new terminal and run calibre from there. If you put in in the global bashrc in /etc just type the export and you're good to go for the life of that terminal window.

Quote:
Originally Posted by quixote View Post
So, if I understand right, I could just set the env var to point to the location of the source files in my /home, even though the program itself is in /opt/calibre/ ?
Yep.
user_none is offline   Reply With Quote
Old 01-02-2011, 07:08 PM   #10
quixote
Junior Member
quixote began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2011
Device: none (Kindle?)
I tried running without a reboot. Printenv still doesn't show the variable (it should, shouldn't it?), and calibre still hangs on the pdf conversion with the same error. I'll wait till after a reboot before I start worrying, though.
quixote is offline   Reply With Quote
Old 01-02-2011, 10:44 PM   #11
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by quixote View Post
I tried running without a reboot. Printenv still doesn't show the variable (it should, shouldn't it?), and calibre still hangs on the pdf conversion with the same error. I'll wait till after a reboot before I start worrying, though.
FYI, while you were busy setting up to run from source, version 0.7.37 was released that corrected the PDF conversion problem.
DoctorOhh is offline   Reply With Quote
Old 01-03-2011, 02:28 PM   #12
quixote
Junior Member
quixote began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jan 2011
Device: none (Kindle?)
When I rebooted, the env variable existed. Sadly, the pdf still stalled at the same error message.

So, I tried 7.37. (The handy linux installer hasn't caught up yet.) The good news is that version does produce a pdf! The bad news is that it seems to lose all the links. And the headers aren't found. There are no chapter breaks, and the TOC contains only the filename. The headers in the convert routine are found in other formats (eg .mobi). I'll try to examine the settings on the pdf part more closely to see if it's something I did wrong.

Still, this is definitely progress.

Update: a thought occurs to me. The env variable is still active, and pointing to the 7.36 source. Maybe that's the problem...? Going to fix now....

Last edited by quixote; 01-03-2011 at 02:31 PM.
quixote is offline   Reply With Quote
Reply

Tags
pdf pdfwriter error

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AttributeError: 'NoneType' object has no attribute 'replace' when trying to add books tilleydog Calibre 16 10-04-2010 04:29 AM
AttributeError: 'NoneType' object has no attribute 'lower manada Calibre 2 08-10-2010 10:54 PM
Line' object has no attribute 'children mazzeltjes Calibre 0 02-12-2010 09:30 AM
'list' object has no attribute 'add_book' etc. mazzeltjes Calibre 1 12-26-2008 01:12 PM
'list' object has no attribute 'add_book' drmathprog Calibre 2 11-13-2008 04:52 PM


All times are GMT -4. The time now is 06:42 AM.


MobileRead.com is a privately owned, operated and funded community.