mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
py2 fix
This commit is contained in:
parent
dc4d0d8e71
commit
047176b297
|
@ -290,6 +290,8 @@ class Up2k(object):
|
||||||
mtpq = "(?)"
|
mtpq = "(?)"
|
||||||
if up_en:
|
if up_en:
|
||||||
ups = [(1, 0, 0, time.time(), "cannot show list (server too busy)")]
|
ups = [(1, 0, 0, time.time(), "cannot show list (server too busy)")]
|
||||||
|
if PY2:
|
||||||
|
ups = []
|
||||||
|
|
||||||
ups.sort(reverse=True)
|
ups.sort(reverse=True)
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ from __future__ import print_function, unicode_literals
|
||||||
import argparse
|
import argparse
|
||||||
import base64
|
import base64
|
||||||
import binascii
|
import binascii
|
||||||
|
import codecs
|
||||||
import errno
|
import errno
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import io
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
@ -3668,7 +3668,7 @@ def load_resource(E: EnvParams, name: str, mode="rb") -> IO[bytes]:
|
||||||
if _pkg_resource_exists(E.pkg.__name__, name):
|
if _pkg_resource_exists(E.pkg.__name__, name):
|
||||||
stream = pkg_resources.resource_stream(E.pkg.__name__, name)
|
stream = pkg_resources.resource_stream(E.pkg.__name__, name)
|
||||||
if enc:
|
if enc:
|
||||||
stream = io.TextIOWrapper(stream, encoding=enc)
|
stream = codecs.getreader(enc)(stream)
|
||||||
return stream
|
return stream
|
||||||
|
|
||||||
return open(os.path.join(E.mod, name), mode, encoding=enc)
|
return open(os.path.join(E.mod, name), mode, encoding=enc)
|
||||||
|
|
Loading…
Reference in a new issue