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


Groups > comp.lang.python > #19841 > unrolled thread

Script randomly exits for seemingly no reason with strange traceback

Started byAndrew Berg <bahamutzero8825@gmail.com>
First post2012-02-03 14:14 -0600
Last post2012-02-15 15:41 -0600
Articles 10 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  Script randomly exits for seemingly no reason with strange traceback Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-03 14:14 -0600
    Re: Script randomly exits for seemingly no reason with strange traceback Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-03 23:25 +0000
      Re: Script randomly exits for seemingly no reason with strange traceback inq1ltd <inq1ltd@inqvista.com> - 2012-02-03 19:15 -0500
        Re: Script randomly exits for seemingly no reason with strange traceback Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-04 02:47 +0000
      Re: Script randomly exits for seemingly no reason with strange traceback Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-04 10:32 -0600
        Re: Script randomly exits for seemingly no reason with strange traceback Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-04 17:06 +0000
          Re: Script randomly exits for seemingly no reason with strange traceback Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-04 12:13 -0600
      Re: Script randomly exits for seemingly no reason with strange traceback Chris Angelico <rosuav@gmail.com> - 2012-02-05 07:43 +1100
        Re: Script randomly exits for seemingly no reason with strange traceback John Nagle <nagle@animats.com> - 2012-02-15 13:28 -0800
          Re: Script randomly exits for seemingly no reason with strange traceback Andrew Berg <bahamutzero8825@gmail.com> - 2012-02-15 15:41 -0600

#19841 — Script randomly exits for seemingly no reason with strange traceback

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2012-02-03 14:14 -0600
SubjectScript randomly exits for seemingly no reason with strange traceback
Message-ID<mailman.5415.1328300143.27778.python-list@python.org>
It's a rare occurrence, but sometimes my script will terminate and I get
this:

Traceback (most recent call last):
  File "C:\path\to\script\script.py", line 992, in <module>

That's it. And the line number is always the last line of the file
(which in my case is a blank line). I have not seen this on Linux (where
my script can run for days or weeks on a remote server), but only on
Windows where I do most of my testing (and it typically only runs for
minutes at a time). There may be bugs in my program, but I don't see how
Python should ever print a traceback like this.
-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640

[toc] | [next] | [standalone]


#19847

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-02-03 23:25 +0000
Message-ID<4f2c6cec$0$29989$c3e8da3$5496439d@news.astraweb.com>
In reply to#19841
On Fri, 03 Feb 2012 14:14:57 -0600, Andrew Berg wrote:

> It's a rare occurrence, but sometimes my script will terminate and I get
> this:
> 
> Traceback (most recent call last):
>   File "C:\path\to\script\script.py", line 992, in <module>
> 
> That's it. And the line number is always the last line of the file
> (which in my case is a blank line).

Is it reproducible? That is, can you demonstrate a script which will 
*always* show this failure?

> I have not seen this on Linux (where
> my script can run for days or weeks on a remote server), but only on
> Windows where I do most of my testing (and it typically only runs for
> minutes at a time). There may be bugs in my program, but I don't see how
> Python should ever print a traceback like this.

Which version of Python, which version of Windows?

If you upgrade Python, does the problem go away?

If you perturb your script (add a few blank lines at the end, or a 
comment), does it go away?


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#19850

Frominq1ltd <inq1ltd@inqvista.com>
Date2012-02-03 19:15 -0500
Message-ID<mailman.5424.1328318382.27778.python-list@python.org>
In reply to#19847
Check your code in that module for open parenthesis something like below..
Most likely your code is looking for the closing  parenthesis.
Start at the bottom and move up.

pink = str(self.RecordKey[2]     <--missing ")"  

jimonlinux



> On Fri, 03 Feb 2012 14:14:57 -0600, Andrew Berg wrote:
> > It's a rare occurrence, but sometimes my script will terminate and I get
> > this:
> > 
> > Traceback (most recent call last):
> >   File "C:\path\to\script\script.py", line 992, in <module>
> > 
> > That's it. And the line number is always the last line of the file
> > (which in my case is a blank line).

[toc] | [prev] | [next] | [standalone]


#19853

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-02-04 02:47 +0000
Message-ID<4f2c9c55$0$29989$c3e8da3$5496439d@news.astraweb.com>
In reply to#19850
On Fri, 03 Feb 2012 19:15:30 -0500, inq1ltd wrote:

> Check your code in that module for open parenthesis something like
> below.. Most likely your code is looking for the closing  parenthesis.
> Start at the bottom and move up.
> 
> pink = str(self.RecordKey[2]     <--missing ")"

If that were the case, the module wouldn't run at all, it would 
consistently raise SyntaxError before running.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#19859

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2012-02-04 10:32 -0600
Message-ID<mailman.5433.1328373163.27778.python-list@python.org>
In reply to#19847
On 2/3/2012 5:25 PM, Steven D'Aprano wrote:
> Which version of Python, which version of Windows?
I keep that information in my signature for every post I make to this list.
CPython 3.2.2 | Windows NT 6.1.7601.17640

> If you upgrade Python, does the problem go away?
I use the most recent stable version. It would be hard to say if the
problem went away since it's rare and random AFAICT.


On 2/3/2012 9:15 PM, Chris Angelico wrote:
> Do you call on potentially-buggy external modules?
It imports one module that does little more than define a few simple
functions. There's certainly no (intentional) interpreter hackery at work.

-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640

[toc] | [prev] | [next] | [standalone]


#19860

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-02-04 17:06 +0000
Message-ID<4f2d6586$0$29989$c3e8da3$5496439d@news.astraweb.com>
In reply to#19859
On Sat, 04 Feb 2012 10:32:25 -0600, Andrew Berg wrote:

> On 2/3/2012 5:25 PM, Steven D'Aprano wrote:
>> Which version of Python, which version of Windows?
> I keep that information in my signature for every post I make to this
> list. CPython 3.2.2 | Windows NT 6.1.7601.17640

Why so you do. Did you expect that people would read it? As a rule, sigs 
fade into the background -- my mail client colours it grey, my news 
client colours it light blue, and I generally don't even notice it.

The Zen of Python applies here: explicit is better than implicit.


>> If you upgrade Python, does the problem go away?
> I use the most recent stable version. It would be hard to say if the
> problem went away since it's rare and random AFAICT.

I suggest you raise an issue on the bug tracker. If you can't reproduce 
the bug, it's unlikely to be fixed, but you might get lucky.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#19862

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2012-02-04 12:13 -0600
Message-ID<mailman.5435.1328379198.27778.python-list@python.org>
In reply to#19860
On 2/4/2012 11:06 AM, Steven D'Aprano wrote:
> I suggest you raise an issue on the bug tracker. If you can't reproduce 
> the bug, it's unlikely to be fixed, but you might get lucky.
Since I can't narrow it down to any specific circumstance or code, I'll
gather information from a build of the interpreter with debugging
enabled first.

-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640

[toc] | [prev] | [next] | [standalone]


#19863

FromChris Angelico <rosuav@gmail.com>
Date2012-02-05 07:43 +1100
Message-ID<mailman.5437.1328388234.27778.python-list@python.org>
In reply to#19847
On Sun, Feb 5, 2012 at 3:32 AM, Andrew Berg <bahamutzero8825@gmail.com> wrote:
> On 2/3/2012 9:15 PM, Chris Angelico wrote:
>> Do you call on potentially-buggy external modules?
> It imports one module that does little more than define a few simple
> functions. There's certainly no (intentional) interpreter hackery at work.

If it's safe for you to do so (copyright/licence etc), it may be worth
posting the code along with your bug report, just in case. I had some
REALLY weird issues from embedding Python that derived, ultimately,
from buggy ref management - one such case came from forgetting to
incref None; it took me a long time to track it down, because the
problem didn't actually surface until the interpreter was shutting
down.

ChrisA

[toc] | [prev] | [next] | [standalone]


#20477

FromJohn Nagle <nagle@animats.com>
Date2012-02-15 13:28 -0800
Message-ID<4f3c238b$0$11951$742ec2ed@news.sonic.net>
In reply to#19863
On 2/4/2012 12:43 PM, Chris Angelico wrote:
> On Sun, Feb 5, 2012 at 3:32 AM, Andrew Berg<bahamutzero8825@gmail.com>  wrote:
>> On 2/3/2012 9:15 PM, Chris Angelico wrote:
>>> Do you call on potentially-buggy external modules?
>> It imports one module that does little more than define a few simple
>> functions. There's certainly no (intentional) interpreter hackery at work.

    Are you doing a conditional import, one that takes place after load
time?  If you do an import within a function or class, it is executed
when the code around it executes.  If you import a file with a
syntax error during execution, you could get the error message you're
getting.

				John Nagle

[toc] | [prev] | [next] | [standalone]


#20480

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2012-02-15 15:41 -0600
Message-ID<mailman.5858.1329342123.27778.python-list@python.org>
In reply to#20477
On 2/15/2012 3:28 PM, John Nagle wrote:
> Are you doing a conditional import, one that takes place after load
> time?  If you do an import within a function or class, it is executed
> when the code around it executes.  If you import a file with a
> syntax error during execution, you could get the error message you're
> getting.
It does have conditional imports, but the tracebacks don't occur while
that function is running (it's executed once, and this happens well after).

-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web