added support for python3
parent
cb287b21a4
commit
849cf7cb7d
|
|
@ -4,4 +4,6 @@ bin/*
|
||||||
*.class
|
*.class
|
||||||
build/
|
build/
|
||||||
*.pyc
|
*.pyc
|
||||||
|
_*
|
||||||
|
!__init__.py
|
||||||
|
|
||||||
|
|
|
||||||
12
main.py
12
main.py
|
|
@ -29,17 +29,17 @@ logi = setupLogger()
|
||||||
def check_dirs_and_files():
|
def check_dirs_and_files():
|
||||||
# log
|
# log
|
||||||
if not os.path.exists(settings.logs):
|
if not os.path.exists(settings.logs):
|
||||||
os.mkdir(settings.logs, 0000755)
|
os.mkdir(settings.logs, 0o000755)
|
||||||
if not os.path.exists(settings.exceptionlog):
|
if not os.path.exists(settings.exceptionlog):
|
||||||
file=open(settings.exceptionlog, 'w')
|
file=open(settings.exceptionlog, 'w')
|
||||||
file.write("<exceptions></exceptions>")
|
file.write("<exceptions></exceptions>")
|
||||||
file.close()
|
file.close()
|
||||||
# lock
|
# lock
|
||||||
if not os.path.exists(settings.locks):
|
if not os.path.exists(settings.locks):
|
||||||
os.mkdir(settings.locks, 0000755)
|
os.mkdir(settings.locks, 0o000755)
|
||||||
# records
|
# records
|
||||||
if not os.path.exists(settings.records):
|
if not os.path.exists(settings.records):
|
||||||
os.mkdir(settings.records, 0000755)
|
os.mkdir(settings.records, 0o000755)
|
||||||
|
|
||||||
def obtainLock(lockfile = settings.lockname):
|
def obtainLock(lockfile = settings.lockname):
|
||||||
#TODO: path
|
#TODO: path
|
||||||
|
|
@ -59,6 +59,10 @@ def formatHost(host):
|
||||||
return "%s:%d" % (host['name'], host['port'])
|
return "%s:%d" % (host['name'], host['port'])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
input = raw_input
|
||||||
|
except NameError:
|
||||||
|
pass
|
||||||
check_dirs_and_files()
|
check_dirs_and_files()
|
||||||
try:
|
try:
|
||||||
logi.info("setting up all sensors")
|
logi.info("setting up all sensors")
|
||||||
|
|
@ -80,7 +84,7 @@ if __name__ == "__main__":
|
||||||
#connection failed, log and exit
|
#connection failed, log and exit
|
||||||
#TODO: logger.printException(inst)
|
#TODO: logger.printException(inst)
|
||||||
logi.error("connection failed: "+str(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")
|
logi.info("stop logging... @" + time.ctime() + "\n")
|
||||||
conSetup.disconnectAny(connections)
|
conSetup.disconnectAny(connections)
|
||||||
freeLock()
|
freeLock()
|
||||||
|
|
|
||||||
2
move.py
2
move.py
|
|
@ -29,7 +29,7 @@ checkfile=os.path.join(locks,movelock)
|
||||||
if not os.path.exists(checkfile):
|
if not os.path.exists(checkfile):
|
||||||
open(checkfile,'w').close()
|
open(checkfile,'w').close()
|
||||||
if not os.path.exists(arch):
|
if not os.path.exists(arch):
|
||||||
os.mkdir(arch, 0000755)
|
os.mkdir(arch, 0o000755)
|
||||||
|
|
||||||
def mycopy(keep):
|
def mycopy(keep):
|
||||||
names = os.listdir(records)
|
names = os.listdir(records)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue