mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 06:13:19 -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
|
||||
days_left = eol.lifetime()
|
||||
logger.info(
|
||||
'Python v{major}.{minor} will reach end of life in {x} days.'.format(
|
||||
major=sys.version_info[0],
|
||||
minor=sys.version_info[1],
|
||||
x=days_left,
|
||||
),
|
||||
)
|
||||
if days_left > 0:
|
||||
logger.info(
|
||||
'Python v{major}.{minor} will reach end of life in {x} days.'.format(
|
||||
major=sys.version_info[0],
|
||||
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:
|
||||
logger.warning('Please upgrade to a more recent Python version.')
|
||||
|
||||
|
|
|
@ -5,15 +5,17 @@ from __future__ import (
|
|||
unicode_literals,
|
||||
)
|
||||
|
||||
from builtins import bytes
|
||||
|
||||
import os
|
||||
|
||||
from six import text_type
|
||||
from six import PY2
|
||||
|
||||
import core
|
||||
from core import logger
|
||||
|
||||
if not PY2:
|
||||
from builtins import bytes
|
||||
|
||||
|
||||
def char_replace(name_in):
|
||||
# Special character hex range:
|
||||
|
@ -26,7 +28,10 @@ def char_replace(name_in):
|
|||
encoding = None
|
||||
if isinstance(name_in, text_type):
|
||||
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)):
|
||||
print('Trying to intuit the encoding')
|
||||
# /!\ 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
|
||||
"""
|
||||
try:
|
||||
raise_for_status(version, grace_period)
|
||||
warn_for_status(version, grace_period)
|
||||
except LifetimeError as error:
|
||||
print('Please use a newer version of Python.')
|
||||
print_statuses()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue