Simple guide to installing Python
-
Download and install ActiveState Python, it’s available from: http://www.activestate.com/store/activepython/download/
-
Open up a command prompt, assuming the files are stored in C:\Files, make sure you go there by typing: cd \Files
-
Then type the name of the script, such as mobihuff.py, and press enter, and it should show instructions.
February 17, 2008 at 3:47 am
Do I need a new install of Python? I get errors using the default version that’s installed in Mac OS 10.4, Can you tell by looking at this where I might have gone wrong?:
mobidedrm.py:42: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up
crc = (~binascii.crc32(s,-1))&0xFFFFFFFF
MobiDeDrm v0.01. Copyright (c) 2008 The Dark Reverser
Traceback (most recent call last):
File “mobidedrm.py”, line 148, in ?
file(outfile, ‘wb’).write(DrmStripper(data_file, pid).getResult())
File “mobidedrm.py”, line 117, in __init__
found_key = self.parseDRM(sect[drm_ptr:drm_ptr+drm_size], drm_count, pid)
File “mobidedrm.py”, line 75, in parseDRM
pid = pid.ljust(16,”)
TypeError: ljust() takes exactly 1 argument (2 given)
March 12, 2008 at 7:16 pm
Great effort! Keep up the good work!
August 5, 2008 at 8:58 am
The error
TypeError: ljust() takes exactly 1 argument (2 given)
means that your version of Python is too old for this script. I think it was in Python 2.4 that the second argument was added to ljust().
August 28, 2008 at 2:00 pm
Does the newly created and stripped mobipocket book contain any information that could lead you back to the original purchaser?
December 23, 2008 at 9:11 am
I’m a total novice with tech stuff. I’m trying to follow instructions to run the program necessary to remove DRM on mobipocket ebooks I’ve purchased so I can read the books on my Sony. I’m trying to download Python and I’m already at a loss!? I downloaded the “AS package” for Windows XP (I hope I picked the right file to download) and now I’m not sure whether to click on the install.py or install (MS DOS file) files in the ActivePython folder! Please help. Thanks in advance!
March 24, 2009 at 8:51 pm
I have found that the .azw works with mobidedrm
April 16, 2009 at 5:46 pm
I am stumped. Have the latest script, get this error on a file:
struct.error: unpack requires a string argument of length 2
April 25, 2009 at 7:47 pm
OK. Thanks for *NOT* replying. It forced me to figure it out. Thanks much for these tools.
April 29, 2009 at 9:03 am
Worked great thanks. Could share a book I just purchased with my buddy 🙂
May 3, 2009 at 4:39 pm
The eReader script. Do Not Like as-is. Appreciate the effort, but without parsing out blocks of book text to tag with and , Calibre produces rot! I don’t know Python, but I’ve studied the script. You seem to search for the PML codes, swap out with HTML, and then just slap a everywhere \n appears. And yet in the DECRYPT part, def santizeFileName, you do:
if c in “abcdefghijklmnopqrstuvwxyz01234567890_.-“:
Well why not carry that over to the PML conversion bit?
After substituting the PML with HTML, and before all the BRs, why not search for something like this:
\nabcdefghijklmnopqrstuvwxyz01234567890″‘–
[last characters are double quote, single quote, and emdash]
And once found, put a there. Then do this search like this:
Find\n go back and see if abcdefghijklmnopqrstuvwxyz01234567890″‘–. and then slap a \n there?
This would give people properly tagged paragraphs that Calibre could then interpret and all the problems with quotes, apostrophes, and the like coming out as boxes or topped-with-circles cap-As would be solved.
Maybe I’m missing something?
May 3, 2009 at 4:40 pm
Damn. Blogger killed my HTML.
wanted bracketed P tags for paragraph text. Does it still make sense up there?
May 3, 2009 at 4:42 pm
TRYING AGAIN, sorry for repeat post:
The eReader script. Do Not Like as-is. Appreciate the effort, but without parsing out blocks of book text to tag with P and slashP tags, Calibre produces rot! I don’t know Python, but I’ve studied the script. You seem to search for the PML codes, swap out with HTML, and then just slap a BR everywhere \n appears. And yet in the DECRYPT part, def santizeFileName, you do:
if c in “abcdefghijklmnopqrstuvwxyz01234567890_.-”:
Well why not carry that over to the PML conversion bit?
After substituting the PML with HTML, and before all the BRs, why not search for something like this:
\nabcdefghijklmnopqrstuvwxyz01234567890″‘–
[last characters are double quote, single quote, and emdash]
And once found, put a P there. Then do this search like this:
Find\n go back and see if abcdefghijklmnopqrstuvwxyz01234567890″‘–. and then slap a slashP\n there?
This would give people properly tagged paragraphs that Calibre could then interpret and all the problems with quotes, apostrophes, and the like coming out as boxes or topped-with-circles cap-As would be solved.
Maybe I’m missing something?
May 3, 2009 at 10:58 pm
I’m trying another tack but getting nowehere.
I notice you commented out the search for double quotes. I’ve been trying to do it to find the curlies and properly change them to lsquo rsquo ldquo and rdquo.
ActivePython 2.5 fails, complaining the Unicodes — u ” \ u2018 ” etc — are outside of the range! Something about an ascii codec. Which makes me believe ain’t no way nohow to get rid of the curlies without separate search & replace in an editor. Which is a pain, because it’s Yet Another Step. (BTW, I put in extra spaces in the Unicode there so Blogger won’t bork it.)
Any possible way in Python with ActivePython 2.5?
May 4, 2009 at 1:30 pm
Argh. Python and ASCII and UniCode. I’m beginning to catch on to why you commented that out and why you’ve avoided the issue altogether. It looks increasingly like no matter what I try to do, I can’t avoid another step using RegExp on the HTML output itself to get what I want.
I noticed the script inserts 8 BRs. I numbered each one to see where. I then modded the script to make p = BRBR to p= nothing. BRs 4-8 I never saw being used. And BRs 1 & 2 really added too much chaos.
Again, thanks for the script. Brilliant work. Too bad the state of tools doesn’t allow for the complete shebang.
May 4, 2009 at 5:57 pm
Yes, well, this will be my last Comment, I hope. I am such a code eejit. I see now the script PUTS IN the curlies, replacing the PML markup. I’m such a dolt, not to have looked at that before. This has probably provided you with lots of laughs. Eh.
June 4, 2009 at 10:00 am
well I’m stumped -I’ve got mobi files i need to get drm free to use on my reader but I just don’t have the computer know how to do this, ive got python & mobidedrm but i’m just not getting it to go
June 17, 2009 at 8:46 pm
Where are the source files i can’t get to them on pastebin anymore?
September 10, 2009 at 9:36 pm
Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.
September 21, 2009 at 5:15 pm
Thanks for the great programs.
I have used ereader2html v3 for my legit ebooks without any problem until this file. File is freebie from BN, have stripped other files from BN & FW with no problem. Using ereader2html with python25. Re-downloaded file in case orig was bad but get same message. File opens & reads fine in BN reader.
This is the error message I get with this file: (re-typed as I don’t know how to copy from command prompt)
File “e2hv3.py”, line 490, in
convertEreaderToHtml
File “e2hv3.py”, line 477, in convertEreaderToHtml
file<os.path.join,”wb’>.write<pml.process>
File “e2hv3.py”, line 417, in process
r = self.next
File “e2hv3.py”, line 349, in next
c = self.s[p+1]
IndexError: string index out of range
My python skills are just at the beginning level so I’m not quite sure where to start first. It’s a free book so if it’s corrupt somehow, I’m not too upset. Out of 100+ books, it’s the only file that I’ve not been able to convert.
Thanks for any help. Beth
September 29, 2009 at 3:21 am
hello, i got an error on some prc files :
Traceback (most recent call last):
File “C:\mobi\Python Script for MobiDeDRM.py”, line 176, in
file(outfile, ‘wb’).write(DrmStripper(data_file, pid).getResult())
File “C:\mobi\Python Script for MobiDeDRM.py”, line 136, in __init__
extra_data_flags, = struct.unpack(‘>L’, sect[0xF0:0xF4])
struct.error: unpack requires a string argument of length 4
Thanks for any help
October 10, 2009 at 3:42 am
Thanks for great codes…
but I encoutered ciritical problem when running your code: ereader2html.py
I followed your instruction, but python return error like this:
File “c:\ereader.py”, line 298
print “Flags: 0x%X” % self.flags
I have some knowdge in python, so I made that line disabled, but another error happened.
File “c:\ereader.py”, line 372
print “unknown escaped code %s” %c
I think there are some problems with print code….but I don’t know exactly.
Plz help me…
March 2, 2010 at 8:37 pm
Hi I think I downloaded the right one and I think I have the script ?? is there anyway u can tell me if I have the right stuff to remove the drm from over a 100 ebooks I’ve bought so I can read them on my ipod touch thanks
please email me 🙂
March 6, 2010 at 11:24 pm
This is great! Thanks for this blog. I am a newbie at django and this will help a lot.
August 10, 2010 at 6:40 pm
Sign: wdpad Hello!!! gnafe and 1480kwvutanktv and 7451 : Great Blog!
August 24, 2010 at 6:36 pm
Sign: zdbrw Hello!!! bfqqc and 120yuetwyyfsa and 8850 : I love your site. 🙂 Love design!!! I just came across your blog and wanted to say that Ive really enjoyed browsing your blog posts.
October 30, 2011 at 5:45 am
sr22 insurance…
[…]Simple guide to installing Python « Darkreverser’s Weblog[…]…