Daemon loses __file__ reference after a while

Laszlo Nagy gandalf at shopzeus.com
Tue Jul 24 14:29:19 CEST 2012


On 2012-07-24 14:17, ivdneut at gmail.com wrote:
> Hello all,
>
> I have a deamon process that runs for some considerable time (weeks) without any problems. At some point it starts throwing the following exception:
>
>    File "/some/path/scheduler.py", line 376, in applyrule
>      result = execrule(rule_code)
>    File "/some/path/scheduler.py", line 521, in execrule
>      rulepath = os.path.dirname(__file__)+"/"+'/'.join(rule['modules'])+"/"+rule['rulename']
> NameError: name '__file__' is not defined
It is not a direct solution to your problem, but can you save the value 
of os.path.dirname(__file__) into another variable?




More information about the Python-list mailing list