Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'exception:': 0.09; 'messing': 0.09; 'nameerror:': 0.09; 'subject:while': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; '(sorry': 0.16; '24,': 0.16; 'ian.': 0.16; 'wrote:': 0.17; 'all,': 0.21; 'defined': 0.22; 'runs': 0.22; 'cc:2**0': 0.23; '>': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'workaround': 0.29; 'starts': 0.29; "i'm": 0.29; 'skip:& 30': 0.30; 'point': 0.31; 'file': 0.32; 'another': 0.33; 'received:google.com': 0.34; 'problem,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'thank': 0.36; 'received:209': 0.37; 'well.': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'some': 0.38; 'google': 0.39; 'your': 0.60; 'july': 0.60; 'you.': 0.61; 'save': 0.61; 'email addr:gmail.com': 0.63; 'direct': 0.69; 'nagy': 0.84 Newsgroups: comp.lang.python Date: Tue, 24 Jul 2012 05:44:23 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=145.23.254.101; posting-account=W0yZ_goAAADAYkC_Qnpsg0MUvOyZ5Sm4 References: <33df007b-6953-4606-871c-7a9b995739f2@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 145.23.254.101 MIME-Version: 1.0 Subject: Re: Daemon loses __file__ reference after a while From: "ivdneut@gmail.com" To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org 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: , Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343133866 news.xs4all.nl 6896 [2001:888:2000:d::a6]:37916 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25986 On Tuesday, July 24, 2012 2:29:19 PM UTC+2, Laszlo Nagy wrote: > 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? That might be a workaround that I'm seriously pondering as well. Thank you. Ian. (sorry for google messing up my posts)