mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 14:13:33 -07:00
fix py2 encoding
This commit is contained in:
parent
7491cfd2f6
commit
fc411d04e2
3 changed files with 25 additions and 11 deletions
|
@ -983,13 +983,22 @@ def check_python():
|
||||||
|
|
||||||
# Log warning if within grace period
|
# Log warning if within grace period
|
||||||
days_left = eol.lifetime()
|
days_left = eol.lifetime()
|
||||||
logger.info(
|
if days_left > 0:
|
||||||
'Python v{major}.{minor} will reach end of life in {x} days.'.format(
|
logger.info(
|
||||||
major=sys.version_info[0],
|
'Python v{major}.{minor} will reach end of life in {x} days.'.format(
|
||||||
minor=sys.version_info[1],
|
major=sys.version_info[0],
|
||||||
x=days_left,
|
minor=sys.version_info[1],
|
||||||
),
|
x=days_left,
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.info(
|
||||||
|
'Python v{major}.{minor} reached end of life {x} days ago.'.format(
|
||||||
|
major=sys.version_info[0],
|
||||||
|
minor=sys.version_info[1],
|
||||||
|
x=-days_left,
|
||||||
|
),
|
||||||
|
)
|
||||||
if days_left <= grace_period:
|
if days_left <= grace_period:
|
||||||
logger.warning('Please upgrade to a more recent Python version.')
|
logger.warning('Please upgrade to a more recent Python version.')
|
||||||
|
|
||||||
|
|
|
@ -5,15 +5,17 @@ from __future__ import (
|
||||||
unicode_literals,
|
unicode_literals,
|
||||||
)
|
)
|
||||||
|
|
||||||
from builtins import bytes
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from six import text_type
|
from six import text_type
|
||||||
|
from six import PY2
|
||||||
|
|
||||||
import core
|
import core
|
||||||
from core import logger
|
from core import logger
|
||||||
|
|
||||||
|
if not PY2:
|
||||||
|
from builtins import bytes
|
||||||
|
|
||||||
|
|
||||||
def char_replace(name_in):
|
def char_replace(name_in):
|
||||||
# Special character hex range:
|
# Special character hex range:
|
||||||
|
@ -26,7 +28,10 @@ def char_replace(name_in):
|
||||||
encoding = None
|
encoding = None
|
||||||
if isinstance(name_in, text_type):
|
if isinstance(name_in, text_type):
|
||||||
return encoded, name_in.encode(core.SYS_ENCODING)
|
return encoded, name_in.encode(core.SYS_ENCODING)
|
||||||
name=bytes(name_in)
|
if PY2:
|
||||||
|
name = name_in
|
||||||
|
else:
|
||||||
|
name = bytes(name_in)
|
||||||
for Idx in range(len(name)):
|
for Idx in range(len(name)):
|
||||||
print('Trying to intuit the encoding')
|
print('Trying to intuit the encoding')
|
||||||
# /!\ detection is done 2char by 2char for UTF-8 special character
|
# /!\ detection is done 2char by 2char for UTF-8 special character
|
||||||
|
|
2
eol.py
2
eol.py
|
@ -96,7 +96,7 @@ def check(version=None, grace_period=0):
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
raise_for_status(version, grace_period)
|
warn_for_status(version, grace_period)
|
||||||
except LifetimeError as error:
|
except LifetimeError as error:
|
||||||
print('Please use a newer version of Python.')
|
print('Please use a newer version of Python.')
|
||||||
print_statuses()
|
print_statuses()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue