From 5f4b7afb0bf8f770032ee21ce67c76194d8d6cb0 Mon Sep 17 00:00:00 2001 From: jellysheep Date: Fri, 6 Mar 2015 14:24:22 +0100 Subject: [ExternalScripts] Encode unicode characters If a file with unicode characters in the filename is downloaded ExternalScripts.py fails with e.g. this error: ExternalScripts: Error in download_finished.sh: 'ascii' codec can't decode byte 0xc3 in position 29: ordinal not in range(128) This commit makes the plugin encode unicode characters to UTF-8. --- module/plugins/hooks/ExternalScripts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index f49220c2a..76a9d9c52 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -74,7 +74,8 @@ class ExternalScripts(Hook): def callScript(self, script, *args): try: - cmd = [script] + [str(x) if not isinstance(x, basestring) else x for x in args] + cmd = [script] + [x.encode("UTF-8") if isinstance(x, unicode) else + str(x) if not isinstance(x, basestring) else x for x in args] self.logDebug("Executing", os.path.abspath(script), " ".join(cmd)) -- cgit v1.2.3