mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-26 18:04:05 +01:00
...
This commit is contained in:
parent
b96ec77417
commit
c1e1d7712b
1 changed files with 4 additions and 16 deletions
|
|
@ -10,16 +10,8 @@
|
|||
import os, sys, re
|
||||
from io import BytesIO
|
||||
|
||||
try:
|
||||
from calibre import force_unicode
|
||||
from calibre.constants import filesystem_encoding
|
||||
filesystem_encoding, force_unicode
|
||||
except ImportError:
|
||||
filesystem_encoding = sys.getfilesystemencoding()
|
||||
def force_unicode(x, enc=filesystem_encoding):
|
||||
if isinstance(x, bytes):
|
||||
x = x.decode(enc, 'replace')
|
||||
return x
|
||||
from calibre import force_unicode
|
||||
from calibre.constants import filesystem_encoding
|
||||
|
||||
class UNRARError(Exception):
|
||||
pass
|
||||
|
|
@ -93,12 +85,8 @@ def test(self, print_names=False):
|
|||
|
||||
|
||||
def RARFile(stream, get_comment=False):
|
||||
try:
|
||||
from calibre.constants import plugins
|
||||
except ImportError:
|
||||
unrar, err = sys.modules['unrar'], None
|
||||
else:
|
||||
unrar, err = plugins['unrar']
|
||||
from calibre.constants import plugins
|
||||
unrar, err = plugins['unrar']
|
||||
if err:
|
||||
raise RuntimeError('Failed to load unrar module with error: %s'
|
||||
%err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue