Need some Python 3 help
Paul McGuire
ptmcg at austin.rr.com
Tue May 25 21:45:59 EDT 2010
I was teetering on the brink of releasing Pyparsing 1.5.3 (with some
nice new examples and goodies), when I saw that I had recently
introduced a bug in the Python 3 compatible version. Here is the
stacktrace as reported on SF:
Traceback (most recent call last):
File "testcase.py", line 11, in <module>
result = exp.parseFile("./pyparsing_py3.py")
File "/data/projekte/parsing/pyparsing/pyparsing_py3.py", line 1426,
in parseFile
return self.parseString(file_contents, parseAll)
File "/data/projekte/parsing/pyparsing/pyparsing_py3.py", line 1068,
in parseString
loc, tokens = self._parse( instring, 0 )
File "/data/projekte/parsing/pyparsing/pyparsing_py3.py", line 935, in
_parseNoCache
preloc = self.preParse( instring, loc )
File "/data/projekte/parsing/pyparsing/pyparsing_py3.py", line 893, in
preParse
while loc < instrlen and instring[loc] in wt:
TypeError: 'in <string>' requires string as left operand, not int
In this section of code, instring is a string, loc is an int, and wt
is a string. Any clues why instring[loc] would be evaluating as int?
(I am unfortunately dependent on the kindness of strangers when it
comes to testing my Python 3 code, as I don't have a Py3 environment
installed.)
Thanks,
-- Paul
More information about the Python-list
mailing list