Re: raise exception with fake filename and linenumber

2010-04-12 Thread Gabriel Genellina
En Fri, 09 Apr 2010 23:19:48 -0300, kwatch escribió: On 4月8日, 午後12:52, "Gabriel Genellina" wrote: The built-in SyntaxError exception does what you want. Constructor parameters are undocumented, but they're as follows: raise SyntaxError("A descriptive error message", (filename, line

Re: raise exception with fake filename and linenumber

2010-04-09 Thread kwatch
On 4月8日, 午後12:52, "Gabriel Genellina" wrote: > > The built-in SyntaxError exception does what you want. Constructor   > parameters are undocumented, but they're as follows: > >     raise SyntaxError("A descriptive error message", (filename, linenum,   > colnum, source_line)) > > colnum is used to

Re: [Q] raise exception with fake filename and linenumber

2010-04-07 Thread Gabriel Genellina
En Wed, 07 Apr 2010 17:23:22 -0300, kwatch escribió: Is it possible to raise exception with custom traceback to specify file and line? I'm creating a certain parser. I want to report syntax error with the same format as other exception. - 1: def parse(filename): 2: i

[Q] raise exception with fake filename and linenumber

2010-04-07 Thread kwatch
Hi all, Is it possible to raise exception with custom traceback to specify file and line? Situation = I'm creating a certain parser. I want to report syntax error with the same format as other exception. Example === parser.py: - 1: def parse(filename): 2: