remove pid if finally
This commit is contained in:
parent
e56e608620
commit
0f100b15ab
18
main.py
18
main.py
@ -58,11 +58,15 @@ def handle_file(message):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
bot.reply_to(message,e )
|
bot.reply_to(message,e )
|
||||||
|
|
||||||
try:
|
if __name__ == '__main__':
|
||||||
pid = str(os.getpid())
|
pid = str(os.getpid())
|
||||||
pidfile = open(config.pid, 'w')
|
pidf = config.pid
|
||||||
pidfile.write(pid)
|
try:
|
||||||
pidfile.close()
|
pidfile = open(pidf, 'w')
|
||||||
bot.polling(none_stop=True, interval=0, timeout=10)
|
pidfile.write(pid)
|
||||||
except Exception as e:
|
pidfile.close()
|
||||||
print(e)
|
bot.polling(none_stop=True, interval=0, timeout=10)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
finally:
|
||||||
|
os.remove(pidf)
|
Loading…
Reference in New Issue
Block a user