View Single Post
Old 08-04-2008, 07:35 PM   #27
wallcraft
reader
wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.
 
wallcraft's Avatar
 
Posts: 6,977
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3, Kobo Glo HD
One problem with mobidedrm is that it does not do any "sanity checking" of its arguments. This would normally be easy to fix, but modifying mobidedrm.py is not legal in the US. So I attach argecho.py from Dive Into Python. If you have problems with mobidedrm, or any other python script, replace the command with argecho. This is almost the simplest possible python program. All it does is echo its arguments, one per line with the 1st line being the command name. For example:

Code:
C:\Documents and Settings\alan\My Documents\My eBooks\SOFTWARE>argecho test file.prc test file.mobi V176CXM*FZ
C:\Documents and Settings\alan\My Documents\My eBooks\SOFTWARE\argecho.py
test
file.prc
test
file.mobi
V176CXM*FZ
This first attempt did not have quotes around the filename, and so what should have been 3 arguments became 5 arguments and the third argument (4th output line) is "test" instead of "V176CXM*FZ". The 1st line of output starts with "C:" because I have argecho.py in the current directory. Adding quotes around the filenames gives the expected 3 arguments.
Code:
C:\Documents and Settings\alan\My Documents\My eBooks\SOFTWARE>argecho "test file.prc" "test file.mobi" V176CXM*FZ
C:\Documents and Settings\alan\My Documents\My eBooks\SOFTWARE\argecho.py
test file.prc
test file.mobi
V176CXM*FZ
There are no doubt many better ways to debug python scripts than using argecho, but using argecho would have made finding past issues with mobidedrm (for example) much easier.
Attached Files
File Type: zip argecho.zip (396 Bytes, 716 views)

Last edited by wallcraft; 08-04-2008 at 07:56 PM.
wallcraft is offline   Reply With Quote