![]() |
#166 |
Liseuse Lover
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 869
Karma: 1035404
Join Date: Jul 2008
Location: Netherlands
Device: PRS-505
|
Beowulf, that is an awesome extension!
Regarding HTML cleanup, I've always used the Aardvark extension to clean up HTML before I print, it might be worth looking at if your considering integrating some kind of cleanup mechanism - why invent the wheel twice? Last edited by acidzebra; 08-28-2008 at 11:57 AM. |
![]() |
![]() |
![]() |
#167 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 208
Karma: 1523
Join Date: Jul 2007
Location: Houston,TX
Device: PRS-T1
|
Quote:
Apparently this is a long standing issue with python that I don't think is fully resolved yet. From what I've read googling about it's sticky problem depending upon what version of python you're using and how you instantiate the file object. However, I'm far from a python expert and am most likely wrong. ![]() If you want I can create a set of testcases and sample code and create a ticket on your site. |
|
![]() |
![]() |
Advert | |
|
![]() |
#168 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 208
Karma: 1523
Join Date: Jul 2007
Location: Houston,TX
Device: PRS-T1
|
Quote:
|
|
![]() |
![]() |
![]() |
#169 | |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,159
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
|
|
![]() |
![]() |
![]() |
#170 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 208
Karma: 1523
Join Date: Jul 2007
Location: Houston,TX
Device: PRS-T1
|
|
![]() |
![]() |
Advert | |
|
![]() |
#171 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
Here's a little wrapper I had used to handle unicode commandline arguments.
Code:
import sys, os, ctypes, pprint class Argvu: def __init__(self,CommandLine=None): if CommandLine==None: CommandLine=ctypes.windll.kernel32.GetCommandLineW() argv_count=ctypes.c_int() cmd_string=ctypes.c_wchar_p(CommandLine) array_memory_address=ctypes.windll.shell32.CommandLineToArgvW(cmd_string,ctypes.byref(argv_count)) match_array_type=ctypes.c_wchar_p*argv_count.value self.argv=[arg for arg in match_array_type.from_address(array_memory_address)] #running from a script: #sys.argv[0] == script.py #our argv[0] == python.exe #running from an exe: #sys.argv[0] == prog.exe #our argv[0] == prog.exe #if we have the first case, we need to remove the interpreter from argv if not sys.argv[0].endswith(".exe") and self.argv[0].endswith(".exe"): self.argv=self.argv[1:] ctypes.windll.kernel32.LocalFree(array_memory_address) def __str__(self): return pprint.pformat(self.result) argv = Argvu().argv if __name__=='__main__': c2a=Argvu() print c2a print c2a.argv |
![]() |
![]() |
![]() |
#172 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#173 | |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,159
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yeah calibre uses something very similar, except its implemented in C. But if I understand beowulf's problem, it's that calibre is not creating the correct output file name.
Quote:
|
|
![]() |
![]() |
![]() |
#174 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 208
Karma: 1523
Join Date: Jul 2007
Location: Houston,TX
Device: PRS-T1
|
You're right, I see python25.dll importing all of those functions.
So, you're code did the trick. I wrote a simple python script that created a file and wrote a utf-8 string to it. If I passed a unicode string in as the filename, it failed in the same we I was seeing. However, if i used your code to obtain the argv array, it works like a champ. I'll write a ticket up for Kovid with details. |
![]() |
![]() |
![]() |
#175 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 208
Karma: 1523
Join Date: Jul 2007
Location: Houston,TX
Device: PRS-T1
|
Sorry Kovid, I was writing my reply as you posted yours.
I think the problem is either the command line arguments are not being converted to python unicode strings from the get go, or, somewhere along the line the string variable containing the output filename is being converted to ascii or some other encoding. The open method must be a true python unicode string not a utf-8 encoded string. |
![]() |
![]() |
![]() |
#176 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,159
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I'll look at the ticket when I get time. But calibre processes unicode arguments correctly on windows (it also uses GetCommandLineW) so the bug is probably elsewhere.
|
![]() |
![]() |
![]() |
#177 | |
Sleeper.
![]() Posts: 109
Karma: 10
Join Date: Dec 2007
Device: Boox Max2, Kinde Voyage, reMarkable, Dasung Paperlike Pro
|
Quote:
I think the editor feature is a great idea and it already does a great job. I wasn't talking about the file names, though, I meant document title in the metadata. It is always empty now. I also found that I cant un-set bold, italic etc. attributes added with the editor. Cheers, jo. Last edited by jotheman; 08-29-2008 at 04:20 AM. |
|
![]() |
![]() |
![]() |
#178 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 208
Karma: 1523
Join Date: Jul 2007
Location: Houston,TX
Device: PRS-T1
|
Quote:
I've found an easier way to reproduce it, cut and paste the following into a console window: Code:
"c:\program files\calibre\web2lrf.exe" -u http://localhost -o abc_ΠΣΩ.lrf default |
|
![]() |
![]() |
![]() |
#179 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 208
Karma: 1523
Join Date: Jul 2007
Location: Houston,TX
Device: PRS-T1
|
Update: 0.4.3
A quick lunchtime release.
Notes for 0.4.3
|
![]() |
![]() |
![]() |
#180 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 208
Karma: 1523
Join Date: Jul 2007
Location: Houston,TX
Device: PRS-T1
|
Quote:
If it's still broken send me platform, firefox version details, and a sample url you see this on. thanks. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
New Plugin Type Idea: Library Plugin | cgranade | Plugins | 3 | 09-15-2010 12:11 PM |
BookIt and 64 bit | jlbfoot | LRF | 0 | 03-09-2009 03:24 PM |
Idea for a "Bookit" Plugin -- Maybe Kovid? | dsuden | Sony Reader | 55 | 01-03-2009 11:22 AM |
Great new Idea! Bookit button | =X= | Feedback | 0 | 10-27-2008 01:49 PM |
Making MobiRead Threads BookIt Friendly | =X= | Feedback | 3 | 08-11-2008 11:24 PM |