Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.064 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'exception:': 0.09; 'nameerror:': 0.09; 'subject:while': 0.09; 'skip:o 70': 0.16; 'wrote:': 0.17; 'all,': 0.21; 'defined': 0.22; 'runs': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; 'starts': 0.29; 'point': 0.31; 'file': 0.32; 'to:addr :python-list': 0.33; 'another': 0.33; 'problem,': 0.35; 'but': 0.36; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'save': 0.61; 'email addr:gmail.com': 0.63; 'direct': 0.69; 'received:204': 0.72 Date: Tue, 24 Jul 2012 14:29:19 +0200 From: Laszlo Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Daemon loses __file__ reference after a while References: <33df007b-6953-4606-871c-7a9b995739f2@googlegroups.com> In-Reply-To: <33df007b-6953-4606-871c-7a9b995739f2@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343132964 news.xs4all.nl 6917 [2001:888:2000:d::a6]:54514 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25983 On 2012-07-24 14:17, ivdneut@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?