Daemon loses __file__ reference after a while.

ivdneut at gmail.com ivdneut at gmail.com
Tue Jul 24 13:48:42 CEST 2012


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.

I am running python from a virtual-env installation from a stock Red Hat EL 6.2 installation:

(virtual-env)[user at host ~]$ python --version
Python 2.6.6
(virtual-env)[user at host ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.2 (Santiago)

I would greatly appreciate any pointers on where to start looking to find the problem.


More information about the Python-list mailing list