Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25979

Daemon loses __file__ reference after a while.

From "ivdneut@gmail.com" <ivdneut@gmail.com>
Newsgroups comp.lang.python
Subject Daemon loses __file__ reference after a while.
Date 2012-07-24 04:48 -0700
Organization http://groups.google.com
Message-ID <bfa7b7ac-d288-4889-8e48-dd0ff0cad711@googlegroups.com> (permalink)

Show all headers | View raw


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.

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)

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

Ian.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Daemon loses __file__ reference after a while. "ivdneut@gmail.com" <ivdneut@gmail.com> - 2012-07-24 04:48 -0700
  Re: Daemon loses __file__ reference after a while. Ervin Hegedüs <airween@gmail.com> - 2012-07-24 14:24 +0200
    Re: Daemon loses __file__ reference after a while. "ivdneut@gmail.com" <ivdneut@gmail.com> - 2012-07-24 05:41 -0700
    Re: Daemon loses __file__ reference after a while. "ivdneut@gmail.com" <ivdneut@gmail.com> - 2012-07-24 05:41 -0700
  Re: Daemon loses __file__ reference after a while. Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-24 14:31 +0200
  Re: Daemon loses __file__ reference after a while. Dieter Maurer <dieter@handshake.de> - 2012-07-24 16:59 +0200
    Re: Daemon loses __file__ reference after a while. Paul Rubin <no.email@nospam.invalid> - 2012-07-24 12:32 -0700
      Re: Daemon loses __file__ reference after a while. Ian Kelly <ian.g.kelly@gmail.com> - 2012-07-24 14:08 -0600
  Re: Daemon loses __file__ reference after a while. Ian Kelly <ian.g.kelly@gmail.com> - 2012-07-24 14:02 -0600

csiph-web