Daemon loses __file__ reference after a while.

Dieter Maurer dieter at handshake.de
Tue Jul 24 16:59:27 CEST 2012


"ivdneut at gmail.com" <ivdneut at gmail.com> writes:

> I have a daemon process that runs for a considerable amount of time (weeks on end) without any problems. At some point I start getting the exception:
>
> Exception info: Traceback (most recent call last):
>   File "scheduler.py", line 376, in applyrule
>     result = execrule(rule_code)
>   File "scheduler.py", line 521, in execrule
>     rulepath = os.path.dirname(__file__)+"/"+'/'.join(rule['modules'])+"/"+rule['rulename']
> NameError: name '__file__' is not defined
>
> This section of the code is executed in this process *all the time*, but suddenly stops working. I have been searching for similar issues online, but only come accross people having problems because they run the script interactively. This is not the case here.

This is strange indeed.

I have only one vague idea: should something try to terminate the
process, modules would start to lose their variables during shutdown.




More information about the Python-list mailing list