Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

warning.warn not defined

2006-01-21
2013-05-14
  • Scot Wilcoxon
    Scot Wilcoxon
    2006-01-21

        warning.warn("Cannot add element of type %s to ParserElement" % type(other),
    NameError: global name 'warning' is not defined

    Should something like "import logging" be mentioned someplace?

     
    • Scot Wilcoxon
      Scot Wilcoxon
      2006-01-21

      Incidentally, I got that type error on the following, and I haven't a clue which thing is the type which is not liked.

          wiki_header = LineStart + Regex( '[=]*' ) + wiki_text + Regex( '[=]*' )

       
    • Scot Wilcoxon
      Scot Wilcoxon
      2006-01-21

      Aha.  LineStart() rather than LineStart.

       
      • Paul McGuire
        Paul McGuire
        2006-01-21

        Sorry to make you solve all your problems yourself!  The warning.warn statements should all read "warnings.warn" - I've fixed this in the current build on my system, as well as added convenience globals lineStart, lineEnd, stringStart, and stringEnd (just as there is a global empty to use in place of Empty()).

        It looks like you are working on a Wiki parser, good luck with this.  I don't think anyone has touched this type of application with pyparsing yet.  (By the way, I think the transformString method may be useful to you.  It is specifically intended for converting input patterns to replacement patterns, as defined in parse actions.)

        -- Paul