mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Use print_function to standardize printing between Python 2 and Python 3
This commit is contained in:
parent
cf1ae938fc
commit
d4e5809a29
3 changed files with 13 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
|
||||||
from six.moves import reload_module
|
from __future__ import print_function
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -9,6 +10,8 @@ import sys
|
||||||
import platform
|
import platform
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from six.moves import reload_module
|
||||||
|
|
||||||
# init libs
|
# init libs
|
||||||
PROGRAM_DIR = os.path.dirname(os.path.normpath(os.path.abspath(os.path.join(__file__, os.pardir))))
|
PROGRAM_DIR = os.path.dirname(os.path.normpath(os.path.abspath(os.path.join(__file__, os.pardir))))
|
||||||
LIBS_DIR = os.path.join(PROGRAM_DIR, 'libs')
|
LIBS_DIR = os.path.join(PROGRAM_DIR, 'libs')
|
||||||
|
@ -261,8 +264,8 @@ def initialize(section=None):
|
||||||
# On non-unicode builds this will raise an AttributeError, if encoding type is not valid it throws a LookupError
|
# On non-unicode builds this will raise an AttributeError, if encoding type is not valid it throws a LookupError
|
||||||
sys.setdefaultencoding(SYS_ENCODING)
|
sys.setdefaultencoding(SYS_ENCODING)
|
||||||
except:
|
except:
|
||||||
print 'Sorry, you MUST add the nzbToMedia folder to the PYTHONPATH environment variable'
|
print('Sorry, you MUST add the nzbToMedia folder to the PYTHONPATH environment variable')
|
||||||
print 'or find another way to force Python to use ' + SYS_ENCODING + ' for string encoding.'
|
print('or find another way to force Python to use ' + SYS_ENCODING + ' for string encoding.')
|
||||||
if 'NZBOP_SCRIPTDIR' in os.environ:
|
if 'NZBOP_SCRIPTDIR' in os.environ:
|
||||||
sys.exit(NZBGET_POSTPROCESS_ERROR)
|
sys.exit(NZBGET_POSTPROCESS_ERROR)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
from __future__ import with_statement
|
|
||||||
|
from __future__ import print_function, with_statement
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
@ -228,7 +229,7 @@ def _processUpgrade(connection, upgradeClass):
|
||||||
try:
|
try:
|
||||||
instance.execute()
|
instance.execute()
|
||||||
except sqlite3.DatabaseError, e:
|
except sqlite3.DatabaseError, e:
|
||||||
print "Error in " + str(upgradeClass.__name__) + ": " + str(e)
|
print("Error in " + str(upgradeClass.__name__) + ": " + str(e))
|
||||||
raise
|
raise
|
||||||
logger.log(upgradeClass.__name__ + " upgrade completed", logger.DEBUG)
|
logger.log(upgradeClass.__name__ + " upgrade completed", logger.DEBUG)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
@ -455,7 +457,7 @@ def convert_to_ascii(inputName, dirName):
|
||||||
logger.info("Renaming directory to: %s." % (base2), 'ENCODER')
|
logger.info("Renaming directory to: %s." % (base2), 'ENCODER')
|
||||||
os.rename(os.path.join(dir, base), dirName)
|
os.rename(os.path.join(dir, base), dirName)
|
||||||
if 'NZBOP_SCRIPTDIR' in os.environ:
|
if 'NZBOP_SCRIPTDIR' in os.environ:
|
||||||
print "[NZB] DIRECTORY=%s" % (dirName) # Return the new directory to NZBGet.
|
print("[NZB] DIRECTORY=%s" % (dirName))
|
||||||
|
|
||||||
for dirname, dirnames, filenames in os.walk(dirName, topdown=False):
|
for dirname, dirnames, filenames in os.walk(dirName, topdown=False):
|
||||||
for subdirname in dirnames:
|
for subdirname in dirnames:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue