Simple guide to installing Python

  1. Download and install ActiveState Python, it’s available from: http://www.activestate.com/store/activepython/download/
  2. Open up a command prompt, assuming the files are stored in C:\Files, make sure you go there by typing: cd \Files
  3. Then type the name of the script, such as mobihuff.py, and press enter, and it should show instructions.
Advertisements

26 Responses to “Simple guide to installing Python”

  1. 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)

  2. Great effort! Keep up the good work!

  3. Paul Durrant Says:

    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().

  4. Does the newly created and stripped mobipocket book contain any information that could lead you back to the original purchaser?

  5. 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!

  6. Dr Pepper Says:

    I have found that the .azw works with mobidedrm

  7. I am stumped. Have the latest script, get this error on a file:

    struct.error: unpack requires a string argument of length 2

  8. mikecane Says:

    OK. Thanks for *NOT* replying. It forced me to figure it out. Thanks much for these tools.

  9. Worked great thanks. Could share a book I just purchased with my buddy 🙂

  10. 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?

  11. Damn. Blogger killed my HTML.

    wanted bracketed P tags for paragraph text. Does it still make sense up there?

  12. 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?

  13. 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?

  14. 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.

  15. 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.

  16. 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

  17. Bill Wheatley Says:

    Where are the source files i can’t get to them on pastebin anymore?

  18. Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.

  19. 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

  20. 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

  21. 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…

  22. natasha klein Says:

    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 🙂

  23. This is great! Thanks for this blog. I am a newbie at django and this will help a lot.

  24. Sign: wdpad Hello!!! gnafe and 1480kwvutanktv and 7451 : Great Blog!

  25. 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.

  26. sr22 insurance…

    […]Simple guide to installing Python « Darkreverser’s Weblog[…]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: