mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fixes for handling of unicode command line arguments on windows
This commit is contained in:
parent
9b7500375b
commit
98725dd828
@ -76,7 +76,8 @@ if iswindows:
|
||||
winutil, winutilerror = plugins['winutil']
|
||||
if not winutil:
|
||||
raise RuntimeError('Failed to load the winutil plugin: %s'%winutilerror)
|
||||
sys.argv[1:] = winutil.argv()[1:]
|
||||
if len(sys.argv) > 1:
|
||||
sys.argv[1:] = winutil.argv()[1-len(sys.argv):]
|
||||
win32event = __import__('win32event')
|
||||
winerror = __import__('winerror')
|
||||
win32api = __import__('win32api')
|
||||
|
@ -31,13 +31,15 @@ _('''Usage: %prog [options] mybook.lit
|
||||
def generate_html2(pathtolit, logger):
|
||||
if not os.access(pathtolit, os.R_OK):
|
||||
raise ConversionError, 'Cannot read from ' + pathtolit
|
||||
tdir = mkdtemp(prefix=__appname__+'_')
|
||||
tdir = mkdtemp(prefix=__appname__+'_'+'lit2oeb_')
|
||||
lr = LitReader(pathtolit)
|
||||
print 'Extracting LIT file to', tdir
|
||||
lr.extract_content(tdir)
|
||||
return tdir
|
||||
|
||||
def generate_html(pathtolit, logger):
|
||||
if isinstance(pathtolit, unicode):
|
||||
pathtolit = pathtolit.encode(sys.getfilesystemencoding())
|
||||
if not os.access(pathtolit, os.R_OK):
|
||||
raise ConversionError, 'Cannot read from ' + pathtolit
|
||||
tdir = mkdtemp(prefix=__appname__+'_')
|
||||
@ -96,7 +98,6 @@ def process_file(path, options, logger=None):
|
||||
options.output = os.path.abspath(os.path.basename(os.path.splitext(path)[0]) + ext)
|
||||
options.output = os.path.abspath(os.path.expanduser(options.output))
|
||||
options.use_spine = True
|
||||
|
||||
html_process_file(htmlfile, options, logger=logger)
|
||||
finally:
|
||||
try:
|
||||
@ -108,7 +109,7 @@ def process_file(path, options, logger=None):
|
||||
def main(args=sys.argv, logger=None):
|
||||
parser = option_parser()
|
||||
options, args = parser.parse_args(args)
|
||||
if len(args) != 2:
|
||||
if len(args) != 2:
|
||||
parser.print_help()
|
||||
print
|
||||
print 'No lit file specified'
|
||||
|
@ -25,6 +25,8 @@ def generate_html(pathtopdf, logger):
|
||||
Convert the pdf into html.
|
||||
@return: Path to a temporary file containing the HTML.
|
||||
'''
|
||||
if isinstance(pathtopdf, unicode):
|
||||
pathtopdf = pathtopdf.encode(sys.getfilesystemencoding())
|
||||
if not os.access(pathtopdf, os.R_OK):
|
||||
raise ConversionError, 'Cannot read from ' + pathtopdf
|
||||
tdir = PersistentTemporaryDirectory('pdftohtml')
|
||||
|
Loading…
x
Reference in New Issue
Block a user