2.1.1 and regexp

Fredrik Lundh fredrik at pythonware.com
Tue Dec 4 08:29:18 CET 2001


Dave Pawson wrote:
> Now I'm even more confused :-)
>
> Trying to use the xpath part of 4suite,
> which uses re.compile.
> A new installation, 2.1.1 with xml 0.66
> and 4suite 0.11.1, gives me an error
>
> compile is not an attribute of re.
> This works with 2.1, same versions of xml and 4suite.

do you get this deep inside the 4suite code, or is this
in your own code?

does it say:

    AttributeError: 're' module has no attribute 'compile'

or

    AttributeError: some object has no attribute 'compile'

if the latter, "re" is probably not what you think:

    import re

    # compile some regexps
    re = re.compile("...")
    re2 = re.compile("...") # oops

if the former, maybe you have your own "re" (or "sre") script
or module somewhere in the path?

adding a "print re" or even "print re.__file__" to the line before
the one that gives you the error might provide additional clues.

running the interpreter with the -v option might also help.

hope this helps!

</F>

<!-- (the eff-bot guide to) the python standard library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list