Kevin D. Smith <Kevin.Smith <at> sas.com> writes: > Below is a test case for an error that I get when generating > documentation for my project. The error I receive is: > > File "build/bdist.darwin-8.3.0-Power_Macintosh/egg/pudge/ > generator.py", line 321, in link_to_source > File "build/bdist.darwin-8.3.0-Power_Macintosh/egg/pudge/ > browser.py", line 178, in source_lines > IndentationError: In module > foobar.longtable.LongTableEndRow.digest: unindent does not match any > outer indentation level
I started using pudge today and encountered the same problem. Apparently, it is a known bug in the tokenize module: http://python.org/sf/1224621 I'm using arigo's proposed patch and it seems to work for me but I haven't tested it much. Below is the the patch I'm using against Python-2.4.2, extracted from arigo's patch. ========== diff -Naur Python-2.4.2-OLD/Lib/tokenize.py Python-2.4.2-NEW/Lib/tokenize.py --- Python-2.4.2-OLD/Lib/tokenize.py 2005-06-21 03:53:56.000000000 -0400 +++ Python-2.4.2-NEW/Lib/tokenize.py 2006-01-31 18:02:33.000000000 -0500 @@ -177,7 +177,7 @@ namechars, numchars = string.ascii_letters + '_', '0123456789' contstr, needcont = '', 0 contline = None - indents = [0] + indents = [] while 1: # loop over lines in stream line = readline() @@ -221,14 +221,16 @@ (lnum, pos), (lnum, len(line)), line) continue - if column > indents[-1]: # count indents or dedents + if not indents: + indents.append(column) + elif column > indents[-1]: # count indents or dedents indents.append(column) yield (INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: - if column not in indents: + indents = indents[:-1] + if indents and column > indents[-1]: raise IndentationError( "unindent does not match any outer indentation level") - indents = indents[:-1] yield (DEDENT, '', (lnum, pos), (lnum, pos), line) else: # continued statement ========== -- Wesley Augur [EMAIL PROTECTED] _______________________________________________ Pudge mailing list [email protected] http://lesscode.org/mailman/listinfo/pudge
