hello, On Tue, Jul 24, 2012 at 04:48:42AM -0700, ivdn...@gmail.com wrote: > Hello, > > 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.
could you send the relevant part of the code? I mean: how do you daemonize your process? > I am running python from a virtual-env installation from a stock Red Hat EL > 6.2 installation: > > (virtual-env)[user@host ~]$ python --version > Python 2.6.6 > (virtual-env)[user@host ~]$ cat /etc/redhat-release > Red Hat Enterprise Linux Server release 6.2 (Santiago) If you use fork(), it drops all file descriptors, and creates new ones - may be then loss the __file__...? a. -- I � UTF-8 -- http://mail.python.org/mailman/listinfo/python-list