From 9877d93385b12ff63094155d2a385589e812caa3 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Wed, 19 Oct 2016 14:46:26 +0000 Subject: [PATCH] * fix "Keys and values must be strings" error * delete the temporary file if we get a printing error * add better error logging in case of printing error git-svn-id: https://xpra.org/svn/Xpra/trunk@14202 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/net/file_transfer.py | 9 ++++++++- src/xpra/platform/pycups_printing.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/xpra/net/file_transfer.py b/src/xpra/net/file_transfer.py index a0874b4e01..4330a46ea6 100644 --- a/src/xpra/net/file_transfer.py +++ b/src/xpra/net/file_transfer.py @@ -319,7 +319,14 @@ def delfile(): printlog.error(" printers available: %s", csv(printers.keys()) or "none") delfile() return - job = print_files(printer, [filename], title, options) + try: + job = print_files(printer, [filename], title, options) + except Exception as e: + printlog("print_files%s", (printer, [filename], title, options), exc_info=True) + printlog.error("Error: cannot print file '%s'", os.path.basename(filename)) + printlog.error(" %s", e) + delfile() + return printlog("printing %s, job=%s", filename, job) if job<=0: printlog("printing failed and returned %i", job) diff --git a/src/xpra/platform/pycups_printing.py b/src/xpra/platform/pycups_printing.py index 9df587019e..f0258df885 100755 --- a/src/xpra/platform/pycups_printing.py +++ b/src/xpra/platform/pycups_printing.py @@ -402,7 +402,7 @@ def print_files(printer, filenames, title, options): raise Exception("invalid printer: '%s'" % printer) log("pycups.print_files%s", (printer, filenames, title, options)) actual_options = DEFAULT_CUPS_OPTIONS.copy() - actual_options.update(options) + actual_options.update(dict(str(k),str(v) for k,v in options.items())) if SIMULATE_PRINT_FAILURE: log.warn("Warning: simulating print failure") conn = None