I have a program running and to be sure that it restarts in case it would crash, I have a cronjob, which tries to run it every few minutes, no matter if it already runs or not. For this I had to us the single_process module. The code is the following one:
from single_process import single_process
@single_process
def main():
... main code ...
if __name__ == "__main__":
main()
I works and I get the following message when I try to start a second instance of it:
<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'> There is an instance of programm.py running. Quit
But sometimes I also get this error:
<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'> There is an instance of programm.py running. Quit
Exception ignored in: <function _ConnectionRecord.checkout.<locals>.<lambda> at 0x7ff29a68e400>
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/pool.py", line 529, in <lambda>
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/pool.py", line 696, in _finalize_fairy
File "/usr/lib/python3.5/logging/__init__.py", line 1308, in error
File "/usr/lib/python3.5/logging/__init__.py", line 1520, in isEnabledFor
TypeError: unorderable types: int() >= NoneType()
Can anybody help? Many thanks in advance.