Change to Python3 coding style

This commit is contained in:
shortcutme 2019-03-15 21:06:59 +01:00
parent fc0fe0557b
commit b0b9a4d33c
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
137 changed files with 910 additions and 913 deletions

View file

@ -7,7 +7,7 @@ import sys
def main():
if "--silent" not in sys.argv:
print "- Starting ZeroNet..."
print("- Starting ZeroNet...")
main = None
try:
@ -30,13 +30,13 @@ def main():
try:
if "lib.opensslVerify" in sys.modules:
sys.modules["lib.opensslVerify"].opensslVerify.closeLibrary()
except Exception, err:
print "Error closing opensslVerify lib", err
except Exception as err:
print("Error closing opensslVerify lib", err)
try:
if "lib.pyelliptic" in sys.modules:
sys.modules["lib.pyelliptic"].openssl.closeLibrary()
except Exception, err:
print "Error closing pyelliptic lib", err
except Exception as err:
print("Error closing pyelliptic lib", err)
# Close lock file
sys.modules["main"].lock.close()
@ -44,23 +44,23 @@ def main():
# Update
try:
update.update()
except Exception, err:
print "Update error: %s" % err
except Exception as err:
print("Update error: %s" % err)
except Exception, err: # Prevent closing
except Exception as err: # Prevent closing
import traceback
try:
import logging
logging.exception("Unhandled exception: %s" % err)
except Exception, log_err:
print "Failed to log error:", log_err
except Exception as log_err:
print("Failed to log error:", log_err)
traceback.print_exc()
from Config import config
traceback.print_exc(file=open(config.log_dir + "/error.log", "a"))
if main and (main.update_after_shutdown or main.restart_after_shutdown): # Updater
import atexit
print "Restarting..."
print("Restarting...")
# Close log files
logger = sys.modules["main"].logging.getLogger()
@ -83,11 +83,11 @@ def main():
args = ['"%s"' % arg for arg in args]
try:
print "Executing %s %s" % (sys.executable, args)
print("Executing %s %s" % (sys.executable, args))
os.execv(sys.executable, args)
except Exception, err:
print "Execv error: %s" % err
print "Bye."
except Exception as err:
print("Execv error: %s" % err)
print("Bye.")
if __name__ == '__main__':