Lines 233-250
Link Here
|
233 |
|
233 |
|
234 |
def debug_office(): |
234 |
def debug_office(): |
235 |
if 'URE_BOOTSTRAP' in os.environ: |
235 |
if 'URE_BOOTSTRAP' in os.environ: |
236 |
print >>sys.stderr, 'URE_BOOTSTRAP=%s' % os.environ['URE_BOOTSTRAP'] |
236 |
print('URE_BOOTSTRAP=%s' % os.environ['URE_BOOTSTRAP'], file=sys.stderr) |
237 |
if 'UNO_PATH' in os.environ: |
237 |
if 'UNO_PATH' in os.environ: |
238 |
print >>sys.stderr, 'UNO_PATH=%s' % os.environ['UNO_PATH'] |
238 |
print('UNO_PATH=%s' % os.environ['UNO_PATH'], file=sys.stderr) |
239 |
if 'UNO_TYPES' in os.environ: |
239 |
if 'UNO_TYPES' in os.environ: |
240 |
print >>sys.stderr, 'UNO_TYPES=%s' % os.environ['UNO_TYPES'] |
240 |
print('UNO_TYPES=%s' % os.environ['UNO_TYPES'], file=sys.stderr) |
241 |
print 'PATH=%s' % os.environ['PATH'] |
241 |
print('PATH=%s' % os.environ['PATH']) |
242 |
if 'PYTHONHOME' in os.environ: |
242 |
if 'PYTHONHOME' in os.environ: |
243 |
print >>sys.stderr, 'PYTHONHOME=%s' % os.environ['PYTHONHOME'] |
243 |
print('PYTHONHOME=%s' % os.environ['PYTHONHOME'], file=sys.stderr) |
244 |
if 'PYTHONPATH' in os.environ: |
244 |
if 'PYTHONPATH' in os.environ: |
245 |
print >>sys.stderr, 'PYTHONPATH=%s' % os.environ['PYTHONPATH'] |
245 |
print('PYTHONPATH=%s' % os.environ['PYTHONPATH'], file=sys.stderr) |
246 |
if 'LD_LIBRARY_PATH' in os.environ: |
246 |
if 'LD_LIBRARY_PATH' in os.environ: |
247 |
print >>sys.stderr, 'LD_LIBRARY_PATH=%s' % os.environ['LD_LIBRARY_PATH'] |
247 |
print('LD_LIBRARY_PATH=%s' % os.environ['LD_LIBRARY_PATH'], file=sys.stderr) |
248 |
|
248 |
|
249 |
def python_switch(office): |
249 |
def python_switch(office): |
250 |
if office.pythonhome: |
250 |
if office.pythonhome: |
Lines 335-344
Link Here
|
335 |
return ret |
335 |
return ret |
336 |
|
336 |
|
337 |
def display(self, doctype): |
337 |
def display(self, doctype): |
338 |
print >>sys.stderr, "The following list of %s formats are currently available:\n" % doctype |
338 |
print("The following list of %s formats are currently available:\n" % doctype, file=sys.stderr) |
339 |
for fmt in self.list: |
339 |
for fmt in self.list: |
340 |
if fmt.doctype == doctype: |
340 |
if fmt.doctype == doctype: |
341 |
print >>sys.stderr, " %-8s - %s" % (fmt.name, fmt) |
341 |
print(" %-8s - %s" % (fmt.name, fmt), file=sys.stderr) |
342 |
print >>sys.stderr |
342 |
print >>sys.stderr |
343 |
|
343 |
|
344 |
fmts = FmtList() |
344 |
fmts = FmtList() |
Lines 530-537
Link Here
|
530 |
'outputpath', 'password=', 'pipe=', 'port=', 'server=', |
530 |
'outputpath', 'password=', 'pipe=', 'port=', 'server=', |
531 |
'timeout=', 'show', 'stdout', 'template', 'verbose', |
531 |
'timeout=', 'show', 'stdout', 'template', 'verbose', |
532 |
'version'] ) |
532 |
'version'] ) |
533 |
except getopt.error, exc: |
533 |
except getopt.error as exc: |
534 |
print 'unoconv: %s, try unoconv -h for a list of all the options' % str(exc) |
534 |
print('unoconv: %s, try unoconv -h for a list of all the options' % str(exc)) |
535 |
sys.exit(255) |
535 |
sys.exit(255) |
536 |
|
536 |
|
537 |
for opt, arg in opts: |
537 |
for opt, arg in opts: |
Lines 562-568
Link Here
|
562 |
except ValueError: |
562 |
except ValueError: |
563 |
self.exportfilter.append( PropertyValue( name, 0, value, 0 ) ) |
563 |
self.exportfilter.append( PropertyValue( name, 0, value, 0 ) ) |
564 |
else: |
564 |
else: |
565 |
print >>sys.stderr, 'Warning: Option %s cannot be parsed, ignoring.' % arg |
565 |
print('Warning: Option %s cannot be parsed, ignoring.' % arg, file=sys.stderr) |
566 |
elif opt in ['-f', '--format']: |
566 |
elif opt in ['-f', '--format']: |
567 |
self.format = arg |
567 |
self.format = arg |
568 |
elif opt in ['-i', '--import']: |
568 |
elif opt in ['-i', '--import']: |
Lines 581-587
Link Here
|
581 |
except ValueError: |
581 |
except ValueError: |
582 |
self.importfilter.append( PropertyValue( name, 0, value, 0 ) ) |
582 |
self.importfilter.append( PropertyValue( name, 0, value, 0 ) ) |
583 |
else: |
583 |
else: |
584 |
print >>sys.stderr, 'Warning: Option %s cannot be parsed, ignoring.' % arg |
584 |
print('Warning: Option %s cannot be parsed, ignoring.' % arg, file=sys.stderr) |
585 |
elif opt in ['-l', '--listener']: |
585 |
elif opt in ['-l', '--listener']: |
586 |
self.listener = True |
586 |
self.listener = True |
587 |
elif opt in ['-n', '--no-launch']: |
587 |
elif opt in ['-n', '--no-launch']: |
Lines 589-595
Link Here
|
589 |
elif opt in ['-o', '--output']: |
589 |
elif opt in ['-o', '--output']: |
590 |
self.output = arg |
590 |
self.output = arg |
591 |
elif opt in ['--outputpath']: |
591 |
elif opt in ['--outputpath']: |
592 |
print >>sys.stderr, 'Warning: This option is deprecated by --output.' |
592 |
print('Warning: This option is deprecated by --output.', file=sys.stderr) |
593 |
self.output = arg |
593 |
self.output = arg |
594 |
elif opt in ['--password']: |
594 |
elif opt in ['--password']: |
595 |
self.password = arg |
595 |
self.password = arg |
Lines 615-627
Link Here
|
615 |
|
615 |
|
616 |
### Enable verbosity |
616 |
### Enable verbosity |
617 |
if self.verbose >= 2: |
617 |
if self.verbose >= 2: |
618 |
print >>sys.stderr, 'Verbosity set to level %d' % self.verbose |
618 |
print('Verbosity set to level %d' % self.verbose, file=sys.stderr) |
619 |
|
619 |
|
620 |
self.filenames = args |
620 |
self.filenames = args |
621 |
|
621 |
|
622 |
if not self.listener and not self.showlist and self.doctype != 'list' and not self.filenames: |
622 |
if not self.listener and not self.showlist and self.doctype != 'list' and not self.filenames: |
623 |
print >>sys.stderr, 'unoconv: you have to provide a filename as argument' |
623 |
print('unoconv: you have to provide a filename as argument', file=sys.stderr) |
624 |
print >>sys.stderr, 'Try `unoconv -h\' for more information.' |
624 |
print('Try `unoconv -h\' for more information.', file=sys.stderr) |
625 |
sys.exit(255) |
625 |
sys.exit(255) |
626 |
|
626 |
|
627 |
### Set connection string |
627 |
### Set connection string |
Lines 659-679
Link Here
|
659 |
### Get office product information |
659 |
### Get office product information |
660 |
product = uno.getComponentContext().ServiceManager.createInstance("com.sun.star.configuration.ConfigurationProvider").createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", UnoProps(nodepath="/org.openoffice.Setup/Product")) |
660 |
product = uno.getComponentContext().ServiceManager.createInstance("com.sun.star.configuration.ConfigurationProvider").createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", UnoProps(nodepath="/org.openoffice.Setup/Product")) |
661 |
|
661 |
|
662 |
print 'unoconv %s' % VERSION |
662 |
print('unoconv %s' % VERSION) |
663 |
print 'Written by Dag Wieers <dag@wieers.com>' |
663 |
print('Written by Dag Wieers <dag@wieers.com>') |
664 |
print 'Homepage at http://dag.wieers.com/home-made/unoconv/' |
664 |
print('Homepage at http://dag.wieers.com/home-made/unoconv/') |
665 |
print |
665 |
print ('\n') |
666 |
print 'platform %s/%s' % (os.name, sys.platform) |
666 |
print('platform %s/%s' % (os.name, sys.platform)) |
667 |
print 'python %s' % sys.version |
667 |
print('python %s' % sys.version) |
668 |
print product.ooName, product.ooSetupVersion |
668 |
print(product.ooName, product.ooSetupVersion) |
669 |
# print |
669 |
# print |
670 |
# print 'build revision $Rev$' |
670 |
# print 'build revision $Rev$' |
671 |
|
671 |
|
672 |
def usage(self): |
672 |
def usage(self): |
673 |
print >>sys.stderr, 'usage: unoconv [options] file [file2 ..]' |
673 |
print('usage: unoconv [options] file [file2 ..]', file=sys.stderr) |
674 |
|
674 |
|
675 |
def help(self): |
675 |
def help(self): |
676 |
print >>sys.stderr, '''Convert from and to any format supported by LibreOffice |
676 |
print('''Convert from and to any format supported by LibreOffice, file=sys.stderr) |
677 |
|
677 |
|
678 |
unoconv options: |
678 |
unoconv options: |
679 |
-c, --connection=string use a custom connection string |
679 |
-c, --connection=string use a custom connection string |
Lines 698-704
Link Here
|
698 |
-t, --template=file import the styles from template (.ott) |
698 |
-t, --template=file import the styles from template (.ott) |
699 |
-T, --timeout=secs timeout after secs if connection to listener fails |
699 |
-T, --timeout=secs timeout after secs if connection to listener fails |
700 |
-v, --verbose be more and more verbose (-vvv for debugging) |
700 |
-v, --verbose be more and more verbose (-vvv for debugging) |
701 |
''' |
701 |
''') |
702 |
|
702 |
|
703 |
class Convertor: |
703 |
class Convertor: |
704 |
def __init__(self): |
704 |
def __init__(self): |
Lines 714-720
Link Here
|
714 |
info(3, 'Connection type: %s' % op.connection) |
714 |
info(3, 'Connection type: %s' % op.connection) |
715 |
try: |
715 |
try: |
716 |
unocontext = resolver.resolve("uno:%s" % op.connection) |
716 |
unocontext = resolver.resolve("uno:%s" % op.connection) |
717 |
except NoConnectException, e: |
717 |
except NoConnectException as e: |
718 |
# info(3, "Existing listener not found.\n%s" % e) |
718 |
# info(3, "Existing listener not found.\n%s" % e) |
719 |
info(3, "Existing listener not found.") |
719 |
info(3, "Existing listener not found.") |
720 |
|
720 |
|
Lines 749-755
Link Here
|
749 |
raise |
749 |
raise |
750 |
else: |
750 |
else: |
751 |
error("Failed to connect to %s (pid=%s) in %d seconds.\n%s" % (office.binary, ooproc.pid, op.timeout, e)) |
751 |
error("Failed to connect to %s (pid=%s) in %d seconds.\n%s" % (office.binary, ooproc.pid, op.timeout, e)) |
752 |
except Exception, e: |
752 |
except Exception as e: |
753 |
raise |
753 |
raise |
754 |
error("Launch of %s failed.\n%s" % (office.binary, e)) |
754 |
error("Launch of %s failed.\n%s" % (office.binary, e)) |
755 |
|
755 |
|
Lines 792-807
Link Here
|
792 |
break |
792 |
break |
793 |
else: |
793 |
else: |
794 |
outputfmt = outputfmt[0] |
794 |
outputfmt = outputfmt[0] |
795 |
# print >>sys.stderr, 'unoconv: format `%s\' is part of multiple doctypes %s, selecting `%s\'.' % (format, [fmt.doctype for fmt in outputfmt], outputfmt[0].doctype) |
795 |
# print('unoconv: format `%s\' is part of multiple doctypes %s, selecting `%s\'.' % (format, [fmt.doctype for fmt in outputfmt], outputfmt[0].doctype), file=sys.stderr) |
796 |
else: |
796 |
else: |
797 |
outputfmt = outputfmt[0] |
797 |
outputfmt = outputfmt[0] |
798 |
|
798 |
|
799 |
### No format found, throw error |
799 |
### No format found, throw error |
800 |
if not outputfmt: |
800 |
if not outputfmt: |
801 |
if doctype: |
801 |
if doctype: |
802 |
print >>sys.stderr, 'unoconv: format [%s/%s] is not known to unoconv.' % (op.doctype, op.format) |
802 |
print('unoconv: format [%s/%s] is not known to unoconv.' % (op.doctype, op.format), file=sys.stderr) |
803 |
else: |
803 |
else: |
804 |
print >>sys.stderr, 'unoconv: format [%s] is not known to unoconv.' % op.format |
804 |
print('unoconv: format [%s] is not known to unoconv.' % op.format, file=sys.stderr) |
805 |
die(1) |
805 |
die(1) |
806 |
|
806 |
|
807 |
return outputfmt |
807 |
return outputfmt |
Lines 813-822
Link Here
|
813 |
outputfmt = self.getformat(inputfn) |
813 |
outputfmt = self.getformat(inputfn) |
814 |
|
814 |
|
815 |
if op.verbose > 0: |
815 |
if op.verbose > 0: |
816 |
print >>sys.stderr, 'Input file:', inputfn |
816 |
print('Input file:', inputfn, file=sys.stderr) |
817 |
|
817 |
|
818 |
if not os.path.exists(inputfn): |
818 |
if not os.path.exists(inputfn): |
819 |
print >>sys.stderr, 'unoconv: file `%s\' does not exist.' % inputfn |
819 |
print('unoconv: file `%s\' does not exist.' % inputfn, file=sys.stderr) |
820 |
exitcode = 1 |
820 |
exitcode = 1 |
821 |
|
821 |
|
822 |
try: |
822 |
try: |
Lines 854-860
Link Here
|
854 |
templateurl = unohelper.absolutize(self.cwd, unohelper.systemPathToFileUrl(op.template)) |
854 |
templateurl = unohelper.absolutize(self.cwd, unohelper.systemPathToFileUrl(op.template)) |
855 |
document.StyleFamilies.loadStylesFromURL(templateurl, templateprops) |
855 |
document.StyleFamilies.loadStylesFromURL(templateurl, templateprops) |
856 |
else: |
856 |
else: |
857 |
print >>sys.stderr, 'unoconv: template file `%s\' does not exist.' % op.template |
857 |
print('unoconv: template file `%s\' does not exist.' % op.template, file=sys.stderr) |
858 |
exitcode = 1 |
858 |
exitcode = 1 |
859 |
|
859 |
|
860 |
### Update document links |
860 |
### Update document links |
Lines 924-963
Link Here
|
924 |
|
924 |
|
925 |
try: |
925 |
try: |
926 |
document.storeToURL(outputurl, tuple(outputprops) ) |
926 |
document.storeToURL(outputurl, tuple(outputprops) ) |
927 |
except IOException, e: |
927 |
except IOException as e: |
928 |
raise UnoException("Unable to store document to %s (ErrCode %d)\n\nProperties: %s" % (outputurl, e.ErrCode, outputprops), None) |
928 |
raise UnoException("Unable to store document to %s (ErrCode %d)\n\nProperties: %s" % (outputurl, e.ErrCode, outputprops), None) |
929 |
|
929 |
|
930 |
phase = "dispose" |
930 |
phase = "dispose" |
931 |
document.dispose() |
931 |
document.dispose() |
932 |
document.close(True) |
932 |
document.close(True) |
933 |
|
933 |
|
934 |
except SystemError, e: |
934 |
except SystemError as e: |
935 |
error("unoconv: SystemError during %s phase:\n%s" % (phase, e)) |
935 |
error("unoconv: SystemError during %s phase:\n%s" % (phase, e)) |
936 |
exitcode = 1 |
936 |
exitcode = 1 |
937 |
|
937 |
|
938 |
except RuntimeException, e: |
938 |
except RuntimeException as e: |
939 |
error("unoconv: RuntimeException during %s phase:\nOffice probably died. %s" % (phase, e)) |
939 |
error("unoconv: RuntimeException during %s phase:\nOffice probably died. %s" % (phase, e)) |
940 |
exitcode = 6 |
940 |
exitcode = 6 |
941 |
|
941 |
|
942 |
except DisposedException, e: |
942 |
except DisposedException as e: |
943 |
error("unoconv: DisposedException during %s phase:\nOffice probably died. %s" % (phase, e)) |
943 |
error("unoconv: DisposedException during %s phase:\nOffice probably died. %s" % (phase, e)) |
944 |
exitcode = 7 |
944 |
exitcode = 7 |
945 |
|
945 |
|
946 |
except IllegalArgumentException, e: |
946 |
except IllegalArgumentException as e: |
947 |
error("UNO IllegalArgument during %s phase:\nSource file cannot be read. %s" % (phase, e)) |
947 |
error("UNO IllegalArgument during %s phase:\nSource file cannot be read. %s" % (phase, e)) |
948 |
exitcode = 8 |
948 |
exitcode = 8 |
949 |
|
949 |
|
950 |
except IOException, e: |
950 |
except IOException as e: |
951 |
# for attr in dir(e): print '%s: %s', (attr, getattr(e, attr)) |
951 |
# for attr in dir(e): print('%s: %s', (attr, getattr(e, attr))) |
952 |
error("unoconv: IOException during %s phase:\n%s" % (phase, e.Message)) |
952 |
error("unoconv: IOException during %s phase:\n%s" % (phase, e.Message)) |
953 |
exitcode = 3 |
953 |
exitcode = 3 |
954 |
|
954 |
|
955 |
except CannotConvertException, e: |
955 |
except CannotConvertException as e: |
956 |
# for attr in dir(e): print '%s: %s', (attr, getattr(e, attr)) |
956 |
# for attr in dir(e): print('%s: %s', (attr, getattr(e, attr))) |
957 |
error("unoconv: CannotConvertException during %s phase:\n%s" % (phase, e.Message)) |
957 |
error("unoconv: CannotConvertException during %s phase:\n%s" % (phase, e.Message)) |
958 |
exitcode = 4 |
958 |
exitcode = 4 |
959 |
|
959 |
|
960 |
except UnoException, e: |
960 |
except UnoException as e: |
961 |
if hasattr(e, 'ErrCode'): |
961 |
if hasattr(e, 'ErrCode'): |
962 |
error("unoconv: UnoException during %s phase in %s (ErrCode %d)" % (phase, repr(e.__class__), e.ErrCode)) |
962 |
error("unoconv: UnoException during %s phase in %s (ErrCode %d)" % (phase, repr(e.__class__), e.ErrCode)) |
963 |
exitcode = e.ErrCode |
963 |
exitcode = e.ErrCode |
Lines 982-988
Link Here
|
982 |
product = self.svcmgr.createInstance("com.sun.star.configuration.ConfigurationProvider").createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", UnoProps(nodepath="/org.openoffice.Setup/Product")) |
982 |
product = self.svcmgr.createInstance("com.sun.star.configuration.ConfigurationProvider").createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", UnoProps(nodepath="/org.openoffice.Setup/Product")) |
983 |
try: |
983 |
try: |
984 |
unocontext = resolver.resolve("uno:%s" % op.connection) |
984 |
unocontext = resolver.resolve("uno:%s" % op.connection) |
985 |
except NoConnectException, e: |
985 |
except NoConnectException as e: |
986 |
pass |
986 |
pass |
987 |
else: |
987 |
else: |
988 |
info(1, "Existing %s listener found, nothing to do." % product.ooName) |
988 |
info(1, "Existing %s listener found, nothing to do." % product.ooName) |
Lines 991-1015
Link Here
|
991 |
subprocess.call([office.binary, "-headless", "-invisible", "-nocrashreport", "-nodefault", "-nologo", "-nofirststartwizard", "-norestore", "-accept=%s" % op.connection], env=os.environ) |
991 |
subprocess.call([office.binary, "-headless", "-invisible", "-nocrashreport", "-nodefault", "-nologo", "-nofirststartwizard", "-norestore", "-accept=%s" % op.connection], env=os.environ) |
992 |
else: |
992 |
else: |
993 |
subprocess.call([office.binary, "--headless", "--invisible", "--nocrashreport", "--nodefault", "--nologo", "--nofirststartwizard", "--norestore", "--accept=%s" % op.connection], env=os.environ) |
993 |
subprocess.call([office.binary, "--headless", "--invisible", "--nocrashreport", "--nodefault", "--nologo", "--nofirststartwizard", "--norestore", "--accept=%s" % op.connection], env=os.environ) |
994 |
except Exception, e: |
994 |
except Exception as e: |
995 |
error("Launch of %s failed.\n%s" % (office.binary, e)) |
995 |
error("Launch of %s failed.\n%s" % (office.binary, e)) |
996 |
else: |
996 |
else: |
997 |
info(1, "Existing %s listener found, nothing to do." % product.ooName) |
997 |
info(1, "Existing %s listener found, nothing to do." % product.ooName) |
998 |
|
998 |
|
999 |
def error(msg): |
999 |
def error(msg): |
1000 |
"Output error message" |
1000 |
"Output error message" |
1001 |
print >>sys.stderr, msg |
1001 |
print(msg, file=sys.stderr) |
1002 |
|
1002 |
|
1003 |
def info(level, msg): |
1003 |
def info(level, msg): |
1004 |
"Output info message" |
1004 |
"Output info message" |
1005 |
if 'op' not in globals(): |
1005 |
if 'op' not in globals(): |
1006 |
pass |
1006 |
pass |
1007 |
elif op.verbose >= 3 and level >= 3: |
1007 |
elif op.verbose >= 3 and level >= 3: |
1008 |
print >>sys.stderr, "DEBUG:", msg |
1008 |
print("DEBUG:", msg, file=sys.stderr) |
1009 |
elif not op.stdout and level <= op.verbose: |
1009 |
elif not op.stdout and level <= op.verbose: |
1010 |
print >>sys.stdout, msg |
1010 |
print >>sys.stdout, msg |
1011 |
elif level <= op.verbose: |
1011 |
elif level <= op.verbose: |
1012 |
print >>sys.stderr, msg |
1012 |
print(msg, file=sys.stderr) |
1013 |
|
1013 |
|
1014 |
def die(ret, msg=None): |
1014 |
def die(ret, msg=None): |
1015 |
"Print optional error and exit with errorcode" |
1015 |
"Print optional error and exit with errorcode" |
Lines 1031-1037
Link Here
|
1031 |
subprocess.Popen([office.binary, "--headless", "--invisible", "--nocrashreport", "--nodefault", "--nofirststartwizard", "--nologo", "--norestore", "--unaccept=%s" % op.connection], env=os.environ) |
1031 |
subprocess.Popen([office.binary, "--headless", "--invisible", "--nocrashreport", "--nodefault", "--nofirststartwizard", "--nologo", "--norestore", "--unaccept=%s" % op.connection], env=os.environ) |
1032 |
ooproc.wait() |
1032 |
ooproc.wait() |
1033 |
info(2, '%s listener successfully disabled.' % product.ooName) |
1033 |
info(2, '%s listener successfully disabled.' % product.ooName) |
1034 |
except Exception, e: |
1034 |
except Exception as e: |
1035 |
error("Terminate using %s failed.\n%s" % (office.binary, e)) |
1035 |
error("Terminate using %s failed.\n%s" % (office.binary, e)) |
1036 |
|
1036 |
|
1037 |
### If there is no GUI attached to the instance, terminate instance |
1037 |
### If there is no GUI attached to the instance, terminate instance |
Lines 1080-1086
Link Here
|
1080 |
for inputfn in op.filenames: |
1080 |
for inputfn in op.filenames: |
1081 |
convertor.convert(inputfn) |
1081 |
convertor.convert(inputfn) |
1082 |
|
1082 |
|
1083 |
except NoConnectException, e: |
1083 |
except NoConnectException as e: |
1084 |
error("unoconv: could not find an existing connection to LibreOffice at %s:%s." % (op.server, op.port)) |
1084 |
error("unoconv: could not find an existing connection to LibreOffice at %s:%s." % (op.server, op.port)) |
1085 |
if op.connection: |
1085 |
if op.connection: |
1086 |
info(0, "Please start an LibreOffice instance on server '%s' by doing:\n\n unoconv --listener --server %s --port %s\n\nor alternatively:\n\n soffice -nologo -nodefault -accept=\"%s\"" % (op.server, op.server, op.port, op.connection)) |
1086 |
info(0, "Please start an LibreOffice instance on server '%s' by doing:\n\n unoconv --listener --server %s --port %s\n\nor alternatively:\n\n soffice -nologo -nodefault -accept=\"%s\"" % (op.server, op.server, op.port, op.connection)) |
Lines 1110-1123
Link Here
|
1110 |
break |
1110 |
break |
1111 |
except: |
1111 |
except: |
1112 |
# debug_office() |
1112 |
# debug_office() |
1113 |
print >>sys.stderr, "unoconv: Cannot find a suitable pyuno library and python binary combination in %s" % of |
1113 |
print("unoconv: Cannot find a suitable pyuno library and python binary combination in %s" % of, file=sys.stderr) |
1114 |
print >>sys.stderr, "ERROR:", sys.exc_info()[1] |
1114 |
print("ERROR:", sys.exc_info()[1], file=sys.stderr) |
1115 |
print >>sys.stderr |
1115 |
print >>sys.stderr |
1116 |
else: |
1116 |
else: |
1117 |
# debug_office() |
1117 |
# debug_office() |
1118 |
print >>sys.stderr, "unoconv: Cannot find a suitable office installation on your system." |
1118 |
print("unoconv: Cannot find a suitable office installation on your system.", file=sys.stderr) |
1119 |
print >>sys.stderr, "ERROR: Please locate your office installation and send your feedback to:" |
1119 |
print("ERROR: Please locate your office installation and send your feedback to:", file=sys.stderr) |
1120 |
print >>sys.stderr, " http://github.com/dagwieers/unoconv/issues" |
1120 |
print(" http://github.com/dagwieers/unoconv/issues", file=sys.stderr) |
1121 |
sys.exit(1) |
1121 |
sys.exit(1) |
1122 |
|
1122 |
|
1123 |
### Now that we have found a working pyuno library, let's import some classes |
1123 |
### Now that we have found a working pyuno library, let's import some classes |
Lines 1160-1165
Link Here
|
1160 |
|
1160 |
|
1161 |
try: |
1161 |
try: |
1162 |
main() |
1162 |
main() |
1163 |
except KeyboardInterrupt, e: |
1163 |
except KeyboardInterrupt as e: |
1164 |
die(6, 'Exiting on user request') |
1164 |
die(6, 'Exiting on user request') |
1165 |
die(exitcode) |
1165 |
die(exitcode) |