mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
prevent unicode error when pasting image
This commit is contained in:
parent
5863453877
commit
7f9593816c
1 changed files with 2 additions and 2 deletions
|
@ -8,7 +8,7 @@ Media support
|
||||||
"""
|
"""
|
||||||
__docformat__ = 'restructuredtext'
|
__docformat__ = 'restructuredtext'
|
||||||
|
|
||||||
import os, stat, time, shutil, re
|
import os, stat, time, shutil, re, sys
|
||||||
from anki.db import *
|
from anki.db import *
|
||||||
from anki.facts import Fact
|
from anki.facts import Fact
|
||||||
from anki.utils import addTags, genID, ids2str, checksum
|
from anki.utils import addTags, genID, ids2str, checksum
|
||||||
|
@ -58,7 +58,7 @@ Update media table. If file already exists, don't copy."""
|
||||||
new = os.path.join(deck.mediaDir(create=True), newBase)
|
new = os.path.join(deck.mediaDir(create=True), newBase)
|
||||||
# copy if not existing
|
# copy if not existing
|
||||||
if not os.path.exists(new):
|
if not os.path.exists(new):
|
||||||
shutil.copy2(path, new)
|
shutil.copy2(path, new.encode(sys.getfilesystemencoding()))
|
||||||
newSize = os.stat(new)[stat.ST_SIZE]
|
newSize = os.stat(new)[stat.ST_SIZE]
|
||||||
if not deck.s.scalar(
|
if not deck.s.scalar(
|
||||||
"select 1 from media where filename = :f",
|
"select 1 from media where filename = :f",
|
||||||
|
|
Loading…
Reference in a new issue