Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'exception': 0.03; 'executed': 0.07; 'stops': 0.07; 'exception:': 0.09; 'incorrect': 0.09; 'nameerror:': 0.09; 'occasionally': 0.09; 'received:mail- lpp01m010-f46.google.com': 0.09; '24,': 0.16; 'idea:': 0.16; "module's": 0.16; 'shutdown.': 0.16; 'skip:o 70': 0.16; 'wrote:': 0.17; 'variables': 0.17; 'working.': 0.17; 'suddenly': 0.22; 'terminate': 0.22; 'defined': 0.22; 'runs': 0.22; 'script': 0.24; 'header:In-Reply-To:1': 0.25; '(most': 0.27; 'am,': 0.27; 'handling': 0.27; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; 'writes:': 0.29; 'received:209.85.215.46': 0.30; 'code': 0.31; 'point': 0.31; 'file': 0.32; 'getting': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'process,': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'modules': 0.36; 'should': 0.36; 'problems': 0.36; 'itself': 0.37; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'strange': 0.62; 'jul': 0.65; 'lose': 0.71; 'email addr:gmail.com"': 0.84; 'to:name:python': 0.84; 'online,': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=CHBSbn8yqXGX5TAZD+yfXOpdODvkUAa/hy5EWMoId4A=; b=vFEKb7pn8SnD1Nu2LIXvE5LdiEAXBZVcY9pjgUKiy4N1Hg5oyseI2SGunhFSEsCyAF v19eVBYGlVpFBX9fOY2w+qCiEzKNUssrXTikHS9PfsjfxR5mJWMS/IKVa8ltsX5lUG4E l+wCoahImlajF5ADixbRwcgpafbiKbllbx3Z2tSrqC7Si9m0v7geOAIeTTymdcOpI00J drPzWmcj0M/kIspzqm2zMXsRkK9uSpbsfbQnYCgSJw1Qp8Hnq8Dm50Zrcovj4cJyVPwM UW0XQlgyxVFr8qhStD0A+bvToDOYKEL+oIuihU6bdwrFSS1wx/TGSLlGKUjBvXgrS2lY i/6w== MIME-Version: 1.0 In-Reply-To: <87y5m9p5m8.fsf@handshake.de> References: <87y5m9p5m8.fsf@handshake.de> From: Ian Kelly Date: Tue, 24 Jul 2012 14:02:49 -0600 Subject: Re: Daemon loses __file__ reference after a while. To: Python Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343160202 news.xs4all.nl 6981 [2001:888:2000:d::a6]:48921 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26006 On Tue, Jul 24, 2012 at 8:59 AM, Dieter Maurer wrote: > "ivdneut@gmail.com" writes: > >> I have a daemon process that runs for a considerable amount of time (wee= ks on end) without any problems. At some point I start getting the exceptio= n: >> >> Exception info: Traceback (most recent call last): >> File "scheduler.py", line 376, in applyrule >> result =3D execrule(rule_code) >> File "scheduler.py", line 521, in execrule >> rulepath =3D 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, b= ut only come accross people having problems because they run the script int= eractively. This is not the case here. > > This is strange indeed. > > I have only one vague idea: should something try to terminate the > process, modules would start to lose their variables during shutdown. That's a good theory. Or perhaps something in the code itself is handling the module's globals() and very occasionally does something that is incorrect and destructive.