Following patch should fix the problem
Index: chm2pdf
===================================================================
--- chm2pdf (revision 28)
+++ chm2pdf (working copy)
@@ -110,7 +110,8 @@
takes the list of files inside the chm archive, with the correct urls of each one.
'''
- os.system('enum_chmLib '+filename+' > '+CHM2PDF_WORK_DIR+'/urlslist.txt')
+ cmd = "enum_chmLib '%s' > '%s/urlslist.txt'" % (filename, CHM2PDF_WORK_DIR)
+ os.system(cmd)
flist=open(CHM2PDF_WORK_DIR+'/urlslist.txt','rU')
urls_list=[]
for line in flist.readlines()[3:]:
@@ -119,7 +120,7 @@
urls_list.append(spline[5])
flist.close()
# os.remove(CHM2PDF_WORK_DIR+'/urlslist.txt')
-
+
return urls_list
@@ -386,7 +387,7 @@
if os.path.exists(page_filename) and (options['titlefile'] == '' or not options['titlefile'] in url):
htmlout_filename=CHM2PDF_WORK_DIR+'/temp'+'%(#)04d' %{"#":c}+'.html'
- htmlout_filename_list+=' '+ htmlout_filename
+ htmlout_filename_list += " '%s'" % (htmlout_filename)
htmlout_filenames.append(htmlout_filename)
if options['dontextract'] == '':
@@ -589,10 +590,12 @@
elif key=='version': htmldoc_opts += ' ' + value
elif key=='webpage': htmldoc_opts += ' ' + value
+ cmd = "htmldoc %s %s -f '%s' > /dev/null" % (htmldoc_opts, htmlout_filename_list, outputfilename)
if options['verbose']=='--verbose' and options['verbositylevel']=='high':
- print 'htmldoc' + htmldoc_opts + ' ' + htmlout_filename_list + " -f "+ outputfilename + " > /dev/null"
- exit_value=os.system ('htmldoc' + htmldoc_opts + ' ' + htmlout_filename_list + " -f "+ outputfilename + " > /dev/null")
+ print cmd
+ exit_value=os.system(cmd)
+
if exit_value != 0:
print 'Something wrong happened when launching htmldoc.'
print 'exit value: ',exit_value
@@ -1072,7 +1075,7 @@
else:
usage(sys.argv[0])
return
-
+
CHM2PDF_WORK_DIR = CHM2PDF_TEMP_WORK_DIR + os.sep + basename
CHM2PDF_ORIG_DIR = CHM2PDF_TEMP_ORIG_DIR + os.sep + basename
@@ -1088,8 +1091,8 @@
if options['dontextract'] == '':
if options['verbose']=='--verbose' and options['verbositylevel']=='high':
print 'Removing any previous temporary files...'
- os.system('rm -r '+CHM2PDF_ORIG_DIR+'/*')
- os.system('rm -r '+CHM2PDF_WORK_DIR+'/*')
+ cmd = "rm -r '%s'/* '%s'/*" % (CHM2PDF_ORIG_DIR, CHM2PDF_WORK_DIR)
+ os.system(cmd)
cfile = chm.CHMFile()
cfile.LoadCHM(filename)
@@ -1100,9 +1103,11 @@
print 'Will use the files in ' + CHM2PDF_ORIG_DIR + ' and ' + CHM2PDF_WORK_DIR + '.'
else:
if options['verbose'] == '--verbose' and options['verbositylevel'] == 'high':
- os.system('extract_chmLib ' + filename + ' ' + CHM2PDF_ORIG_DIR)
+ cmd = "extract_chmLib '%s' '%s'" % (filename, CHM2PDF_ORIG_DIR)
+ os.system(cmd)
else:
- os.system('extract_chmLib ' + filename + ' ' + CHM2PDF_ORIG_DIR + '&> /dev/null')
+ cmd = "extract_chmLib '%s' '%s' &>/dev/null" % (filename, CHM2PDF_ORIG_DIR)
+ os.system(cmd)
convert_to_pdf(cfile, filename, outputfilename, options)
Attaching the patch file.
Thanks and Regards,
Prasad