mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
tolerate a str arg to writeData()
This commit is contained in:
parent
d503b62cd1
commit
2d4e88afbd
1 changed files with 4 additions and 0 deletions
|
@ -89,6 +89,10 @@ class MediaManager(object):
|
||||||
return self.writeData(opath, open(opath, "rb").read())
|
return self.writeData(opath, open(opath, "rb").read())
|
||||||
|
|
||||||
def writeData(self, opath, data):
|
def writeData(self, opath, data):
|
||||||
|
if not isinstance(opath, unicode):
|
||||||
|
# old code/addons were passing as str
|
||||||
|
print "writeData() should be called with unicode"
|
||||||
|
opath = unicode(opath, "utf8", "ignore")
|
||||||
# if fname is a full path, use only the basename
|
# if fname is a full path, use only the basename
|
||||||
fname = os.path.basename(opath)
|
fname = os.path.basename(opath)
|
||||||
# make sure we write it in NFC form (on mac will autoconvert to NFD),
|
# make sure we write it in NFC form (on mac will autoconvert to NFD),
|
||||||
|
|
Loading…
Reference in a new issue