Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Tue Dec 9 17:57:37 EST 2008
On Tue, 09 Dec 2008 13:11:40 -0500, Albert Hopkins wrote:
> The difference is under Python 2.4 I get a traceback with the lineno and
> offending line, but I do not get a traceback in Pythons 2.6 and 3.0.
If tracebacks are broken, surely that would be a pretty huge bug. It
seems to be broken in 2.5 as well:
>>> def a(x):
... def b():
... x
... del x
...
SyntaxError: can not delete variable 'x' referenced in nested scope
> So is there a way to find the offending code w/o having to go through
> every line of code in 'foo' by hand?
Just search for "del x" in your code. Your editor does have a search
function, surely?
--
Steven
More information about the Python-list
mailing list