Fix bug when using writefile in duktape

This commit is contained in:
Kovid Goyal 2015-10-16 16:43:49 +05:30
parent d2ba80ec41
commit 485c2d8af1

View File

@ -128,9 +128,10 @@ def writefile(path, data, enc='utf-8'):
with open(path, 'wb') as f:
f.write(data)
except UnicodeEncodeError as e:
return '', 'Failed to encode the data for file: %s with specified encoding: %s' % (path, enc)
return ['', 'Failed to encode the data for file: %s with specified encoding: %s' % (path, enc)]
except EnvironmentError as e:
return [errno.errorcode[e.errno], 'Failed to write to file: %s with error: %s' % (path, e.message or e)]
return [None, None]
class Function(object):