mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Fix bug when using writefile in duktape
This commit is contained in:
parent
d2ba80ec41
commit
485c2d8af1
@ -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):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user