Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: non descriptive error

Reply
Thread Tools

Re: non descriptive error

 
 
Timothy Smith
Guest
Posts: n/a
 
      10-11-2005
Fredrik Lundh wrote:

>Timothy Smith wrote:
>
>
>>i have reproduced the error in this code block
>>
>>#save values in edit
>>self.FinaliseTill.SaveEditControlValue()
>>if
>>Decimal(self.parent.TillDetails[self.TillSelection.GetStringSelection()]['ChangeTinBalance']))
>>== Decimal('0'):
>>#box must be checked before continuing
>>if self.PlacedInSafe.GetValue() != 1:
>>self.parent.Popup("You must place the till draw back in the
>>safe","Till draw")
>>else:
>>#finalise the till draw
>>if Decimal(self.TillFloat.GetLabel().split('$')[1]) != Decimal('0'):
>>Prompt = wx.MessageDialog(self,"""The correct amount has not been
>>returned from the till draw float to the main float!
>>If you proceed please contact your manager""","Change tin doesn't
>>balance!",wx.YES_NO)
>>if Prompt.ShowModal() == wx.ID_YES:
>>self.Submit()
>>else:
>>self.parent.Popup('You have an outstanding change tin balance on this
>>till','Change tin')
>>
>>i have NO idea what in there could be making it have such a strange
>>error. it just says "error" when you try run it. there nothing terribly
>>strange being done.
>>
>>

>
>the snippet you posted gives
>
>$ python script.py
> File "script.py", line 2
> self.FinaliseTill.SaveEditControlValue()
> ^
>SyntaxError: invalid syntax
>
>on my python 2.3 install.
>
>are you sure you don't have some weird sitecustomize file on your
>machine? (more likely, it's a wxPython issue. can you reproduce
>this without using wxPython ?)
>
></F>
>
>
>
>
>

i am still coming across this error it's driving me nuts. usually i can
find what's wrong, but it is becoming an increasingly annoying problem.
i also get the same problem on a windows machine with the same
installed. this time it's nothing to do with the decimal module. help!
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      10-12-2005
Timothy Smith wrote:

>>> i have NO idea what in there could be making it have such a strange
>>> error. it just says "error" when you try run it. there nothing terribly
>>> strange being done.


> i am still coming across this error it's driving me nuts. usually i can
> find what's wrong, but it is becoming an increasingly annoying problem.
> i also get the same problem on a windows machine with the same
> installed. this time it's nothing to do with the decimal module. help!


Go back to first principles. Can you grab all the
modules being used, and search them for the string
"error"? Ignore any hits which are in a comment. One of
the others is almost certainly responsible.

You can test that by changing the string to "this is a
PITA" and see if your mysterious error message changes
or not.



--
Steven.

 
Reply With Quote
 
 
 
 
Ron Adam
Guest
Posts: n/a
 
      10-12-2005
Steven D'Aprano wrote:
> Timothy Smith wrote:
>
>>>> i have NO idea what in there could be making it have such a strange
>>>> error. it just says "error" when you try run it. there nothing terribly
>>>> strange being done.

>
>
>> i am still coming across this error it's driving me nuts. usually i
>> can find what's wrong, but it is becoming an increasingly annoying
>> problem. i also get the same problem on a windows machine with the
>> same installed. this time it's nothing to do with the decimal module.
>> help!

>
>
> Go back to first principles. Can you grab all the modules being used,
> and search them for the string "error"? Ignore any hits which are in a
> comment. One of the others is almost certainly responsible.
>
> You can test that by changing the string to "this is a PITA" and see if
> your mysterious error message changes or not.


Maybe there's a way he can examine the traceback to find it.

I think there's probably a better way, but it may be a start.


####
def seetrace():
import inspect
print inspect.trace()
print ''.join(inspect.trace(5)[0][4])

try:
try:
#### suspect code block
a = 15+'c'
print 'hello'
for x in range(10):
a = x
####
except:
seetrace()
raise "my error" # you never see this

# This is why bare excepts are not a good idea.
except:
raise "Error: your error"
####

In this example you never see "my error" because the outer try over
rides it. but the prints's still print and give you information about
the actual error in this case.


[(<frame object at 0x009A5628>, 'gen.py', 17, '?', [" a =
15+'c'\n"], 0)]
try:
#### suspect code block
a = 15+'c'
print 'hello'
for x in range(10):

Traceback (most recent call last):
File "gen.py", line 26, in ?
raise "your error"
Error: your error


Hope this helps,
Ron

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting more descriptive ERB errors listrecv@gmail.com Ruby 0 03-06-2006 11:09 PM
Re: non descriptive error Timothy Smith Python 4 10-10-2005 06:30 AM
non descriptive error Timothy Smith Python 2 10-07-2005 10:24 AM
The original subject seems to be quite descriptive Anupam C Programming 3 10-31-2003 05:44 AM
.net and descriptive concepts! Amir Pashazadeh ASP .Net 1 07-18-2003 01:34 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57