3

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.

sunwarr10r
  • 4,420
  • 8
  • 54
  • 109
  • I have got the exact same issue, I can't work out exactly why it's happening but https://stackoverflow.com/questions/38036540/what-type-of-message-exception-ignored-in-is has a good description as a starting point. In my case I have a bunch of threads running sqlalchemy stuff but I only started seeing this after moving from python2.7 to 3.5. No idea if the issue is with sqlalchemy, or my code. From reading the code of `isEnabledFor`, it seems that line of isEnabledFor is `if self.manager.disable >= level:`, which seems to imply that `level` is set to `None`. I can't see how that's happening... – Tom Dalton Mar 19 '18 at 17:16

0 Answers0