From 849cf7cb7d83a4c20af86eff88ca46ec34f46c24 Mon Sep 17 00:00:00 2001 From: agp8x Date: Tue, 25 Aug 2015 17:21:58 +0200 Subject: [PATCH] added support for python3 --- .gitignore | 2 ++ main.py | 12 ++++++++---- move.py | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index afae7d9..097e0cf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ bin/* *.class build/ *.pyc +_* +!__init__.py diff --git a/main.py b/main.py index d268a43..07be8d2 100644 --- a/main.py +++ b/main.py @@ -29,17 +29,17 @@ logi = setupLogger() def check_dirs_and_files(): # log if not os.path.exists(settings.logs): - os.mkdir(settings.logs, 0000755) + os.mkdir(settings.logs, 0o000755) if not os.path.exists(settings.exceptionlog): file=open(settings.exceptionlog, 'w') file.write("") file.close() # lock if not os.path.exists(settings.locks): - os.mkdir(settings.locks, 0000755) + os.mkdir(settings.locks, 0o000755) # records if not os.path.exists(settings.records): - os.mkdir(settings.records, 0000755) + os.mkdir(settings.records, 0o000755) def obtainLock(lockfile = settings.lockname): #TODO: path @@ -59,6 +59,10 @@ def formatHost(host): return "%s:%d" % (host['name'], host['port']) if __name__ == "__main__": + try: + input = raw_input + except NameError: + pass check_dirs_and_files() try: logi.info("setting up all sensors") @@ -80,7 +84,7 @@ if __name__ == "__main__": #connection failed, log and exit #TODO: logger.printException(inst) logi.error("connection failed: "+str(inst)) - raw_input("Press key to restart\n") + input("Press key to restart\n") logi.info("stop logging... @" + time.ctime() + "\n") conSetup.disconnectAny(connections) freeLock() diff --git a/move.py b/move.py index b61368f..71f335a 100644 --- a/move.py +++ b/move.py @@ -29,7 +29,7 @@ checkfile=os.path.join(locks,movelock) if not os.path.exists(checkfile): open(checkfile,'w').close() if not os.path.exists(arch): - os.mkdir(arch, 0000755) + os.mkdir(arch, 0o000755) def mycopy(keep): names = os.listdir(records)