• Jamie Mazer

    Jamie Mazer - 2008-03-05

    Has anyone updated bundlepwm.py to get it working with python2.5?
    The version packaged with 1.3.2 depends on regsub.gsub() which no
    longer exists..

    • Greg McFarlane

      Greg McFarlane - 2008-03-06

      The fix to this is fairly simple.  In bundlepmw.py change "import regsub" to "import re" and change each of the five occurrences of "regsub.gsub" to "re.sub".

      Hopefully this will make it into the next release...

      • Jamie Mazer

        Jamie Mazer - 2008-03-06

        Hi Greg,

        I must be missing something -- I actually did before asking here, but
        the resulting Pmw.py file still contains "import Pmw" commands and
        "Pmw.XXX" references. The resulting file works fine if I go in and
        manually delete all the Pmw references -- looks like the "import
        Pmw\>" and "\<Pmw\." re's don't work.

        Did anything about regexp syntax change between regsub.gsub and
        re.sub?  I can't find anything in the docs that leads me to believe
        there's a difference, but it's been a while since I used re's for


        • Greg McFarlane

          Greg McFarlane - 2008-03-07

          Woops! You are right.  Instead of "\<" and "\>" in regsub (which mean beginning and end of word), re uses "\b" for both.  Also, since "\b" is special in a string, the "\" has to be escaped like this: "\\".  So the two changed lines are:

          text = re.sub('import Pmw\\b', '', text)
          text = re.sub('\\bPmw\.', '', text)

    • Jamie Mazer

      Jamie Mazer - 2008-03-06

      Hate to followup my own post, but if I change:
          text = regsub.gsub('import Pmw\>', '', text)
          text = regsub.gsub('INITOPT = Pmw.INITOPT', '', text)
          text = regsub.gsub('\<Pmw\.', '', text)
          text = re.sub('import Pmw', '', text)
          text = re.sub('INITOPT = Pmw.INITOPT', '', text)
          text = re.sub('Pmw\\.', '', text)
      in mungeFile(). It looks like it works (no exhaustive testing,
      but it's importable). I'm not sure why the angle brackets
      were there in the first place.. and with the \'s, it seems
      like they're literals to boot, which seems wrong...


    • nanotube

      nanotube - 2009-07-07


      This problem is now fixed in my fork git repository, here:

      See also my announcement of the fork:


Log in to post a comment.