Loading ...
Sorry, an error occurred while loading the content.

Re: [Cheetahtemplate-discuss] Importing Cheetah.Template.Template unusually slow?

Expand Messages
  • Graham Dennis
    ... I remember having this problem myself and I traced it down to Servlet.py where it tries to do: from WebKit.Servlet import Servlet as BaseServlet. What s
    Message 1 of 24 , Jan 27, 2010
    • 0 Attachment


      On 28 Jan 2010, at 8:19 AM, Matthew Beauregard wrote:

      So I guess I'd have to blame some interaction between Cheetah and Apple's framework python.  I'm not sure what to do next.

      I remember having this problem myself and I traced it down to Servlet.py where it tries to do:
      from WebKit.Servlet import Servlet as BaseServlet.

      What's happening here is that on Mac OS X Leopard and later the 'WebKit' import resolves to the system framework WebKit which is available via the PyObjC bridge. However, once the import of 'WebKit' has succeeded, 'WebKit.Servlet' fails, and you're wasting much of your time on a line that does nothing.

      I created a hack to get around this which installs an empty module called 'WebKit' (only on Mac OS X), so that when Cheetah tries to import WebKit it gets this module instead and fails much faster.

      def leopardWebKitHack():
          """
          Hack for Mac OS X Leopard and above so that it doesn't import
          the web rendering framework WebKit when Cheetah tries to import
          the Python web application framework WebKit.
          """
          if sys.platform == 'darwin' and not 'WebKit' in sys.modules:
              module = type(sys)
              sys.modules['WebKit'] = module('WebKit')

      Just make sure you call that before importing Cheetah.Template.

      time python -c 'from Cheetah.Template import Template'

      real 0m0.682s
      user 0m0.550s
      sys 0m0.121s

      time python -c 'import sys; sys.modules["WebKit"] = type(sys)("WebKit");from Cheetah.Template import Template'

      real 0m0.130s
      user 0m0.083s
      sys 0m0.044s


      Cheers,
      Graham
    • Aahz
      ... /Users/aahz/Library/Python/2.6/site-packages/Cheetah-2.0.1-py2.6-macosx-10.3-fat.egg/Cheetah/Template.pyc -rw-r--r-- 1 aahz staff 69039 Aug 12 14:26
      Message 2 of 24 , Jan 27, 2010
      • 0 Attachment
        On Wed, Jan 27, 2010, R. Tyler Ballance wrote:
        >
        > What version are Cheetah are you running? I'm also curious if your machine
        > isn't generating a Template.pyc for Template.py, causing the interpreter to
        > generate new byte-code for every request.

        >>> Template.__file__
        '/Users/aahz/Library/Python/2.6/site-packages/Cheetah-2.0.1-py2.6-macosx-10.3-fat.egg/Cheetah/Template.pyc'

        -rw-r--r-- 1 aahz staff 69039 Aug 12 14:26 Template.pyc
        --
        Aahz (aahz@...) <*> http://www.pythoncraft.com/

        import antigravity

        ------------------------------------------------------------------------------
        The Planet: dedicated and managed hosting, cloud storage, colocation
        Stay online with enterprise data centers and the best network in the business
        Choose flexible plans and management services without long-term contracts
        Personal 24x7 support from experience hosting pros just a phone call away.
        http://p.sf.net/sfu/theplanet-com
        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      • R. Tyler Ballance
        ... I think you re onto something here :) I m willing to bet that the framework builds have sys.path set such that the Apple WebKit module can be imported
        Message 3 of 24 , Jan 27, 2010
        • 0 Attachment
          On Thu, 28 Jan 2010, Graham Dennis wrote:

          > I tried to post this message earlier, but I think my mail server is having a hissy fit. Apologies if anyone gets this twice.

          I think you're onto something here :)

          I'm willing to bet that the framework builds have sys.path set such that the
          Apple WebKit module can be imported properly whereas the macports build would
          not have the proper path set.


          I don't know anybody that uses WebWare to be honest so I think it'd be safe to
          just drop that WebKit cruft from Servlet.py, or I could just incorporate your
          hack around it :P


          >
          > On 28/01/2010, at 8:19 AM, Matthew Beauregard wrote:
          > > So I guess I'd have to blame some interaction between Cheetah and Apple's framework python. I'm not sure what to do next.
          >
          > I remember having this problem myself and I traced it down to Servlet.py where it tries to do:
          > from WebKit.Servlet import Servlet as BaseServlet.
          >
          > What's happening here is that on Mac OS X Leopard and later the 'WebKit' import resolves to the system framework WebKit which is available via the PyObjC bridge. However, once the import of 'WebKit' has succeeded, 'WebKit.Servlet' fails, and you're wasting much of your time on a line that does nothing.
          >
          > I created a hack to get around this which installs an empty module called 'WebKit' (only on Mac OS X), so that when Cheetah tries to import WebKit it gets this module instead and fails much faster.
          >
          > def leopardWebKitHack():
          > """
          > Hack for Mac OS X Leopard and above so that it doesn't import
          > the web rendering framework WebKit when Cheetah tries to import
          > the Python web application framework WebKit.
          > """
          > if sys.platform =3D=3D 'darwin' and not 'WebKit' in sys.modules:
          > module =3D type(sys)
          > sys.modules['WebKit'] =3D module('WebKit')
          >
          > Just make sure you call that before importing Cheetah.Template.
          >
          > time python -c 'from Cheetah.Template import Template'
          >
          > real 0m0.682s
          > user 0m0.550s
          > sys 0m0.121s
          >
          > time python -c 'import sys; sys.modules["WebKit"] = type(sys)("WebKit");from Cheetah.Template import Template'
          >
          > real 0m0.130s
          > user 0m0.083s
          > sys 0m0.044s
          >
          >
          > Cheers,
          > Graham
          >
          >
          > ------------------------------------------------------------------------------
          > The Planet: dedicated and managed hosting, cloud storage, colocation
          > Stay online with enterprise data centers and the best network in the business
          > Choose flexible plans and management services without long-term contracts
          > Personal 24x7 support from experience hosting pros just a phone call away.
          > http://p.sf.net/sfu/theplanet-com
          > _______________________________________________
          > Cheetahtemplate-discuss mailing list
          > Cheetahtemplate-discuss@...
          > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
          Cheers,
          -R. Tyler Ballance
          --------------------------------------
          Jabber: rtyler@...
          GitHub: http://github.com/rtyler
          Twitter: http://twitter.com/agentdero
          Blog: http://unethicalblogger.com
        • Tavis Rudd
          ... As one of the few people that still uses WebWare in production (legacy app in maintenance mode ...), I think you could go ahead and drop it. ... The
          Message 4 of 24 , Jan 27, 2010
          • 0 Attachment
            On Wed, 27 Jan 2010, R. Tyler Ballance wrote:

            >
            > On Thu, 28 Jan 2010, Graham Dennis wrote:
            >
            >> I tried to post this message earlier, but I think my mail server is having a hissy fit. Apologies if anyone gets this twice.
            >
            > I think you're onto something here :)
            >
            > I'm willing to bet that the framework builds have sys.path set such that the
            > Apple WebKit module can be imported properly whereas the macports build would
            > not have the proper path set.
            >
            >
            > I don't know anybody that uses WebWare to be honest so I think it'd be safe to
            > just drop that WebKit cruft from Servlet.py, or I could just incorporate your
            > hack around it :P

            As one of the few people that still uses WebWare in production (legacy app
            in maintenance mode ...), I think you could go ahead and drop it.


            >>
            >> On 28/01/2010, at 8:19 AM, Matthew Beauregard wrote:
            >>> So I guess I'd have to blame some interaction between Cheetah and Apple's framework python. I'm not sure what to do next.
            >>
            >> I remember having this problem myself and I traced it down to Servlet.py where it tries to do:
            >> from WebKit.Servlet import Servlet as BaseServlet.
            >>
            >> What's happening here is that on Mac OS X Leopard and later the 'WebKit' import resolves to the system framework WebKit which is available via the PyObjC bridge. However, once the import of 'WebKit' has succeeded, 'WebKit.Servlet' fails, and you're wasting much of your time on a line that does nothing.
            >>
            >> I created a hack to get around this which installs an empty module called 'WebKit' (only on Mac OS X), so that when Cheetah tries to import WebKit it gets this module instead and fails much faster.
            >>
            >> def leopardWebKitHack():
            >> """
            >> Hack for Mac OS X Leopard and above so that it doesn't import
            >> the web rendering framework WebKit when Cheetah tries to import
            >> the Python web application framework WebKit.
            >> """
            >> if sys.platform =3D=3D 'darwin' and not 'WebKit' in sys.modules:
            >> module =3D type(sys)
            >> sys.modules['WebKit'] =3D module('WebKit')
            >>
            >> Just make sure you call that before importing Cheetah.Template.
            >>
            >> time python -c 'from Cheetah.Template import Template'
            >>
            >> real 0m0.682s
            >> user 0m0.550s
            >> sys 0m0.121s
            >>
            >> time python -c 'import sys; sys.modules["WebKit"] = type(sys)("WebKit");from Cheetah.Template import Template'
            >>
            >> real 0m0.130s
            >> user 0m0.083s
            >> sys 0m0.044s
            >>
            >>
            >> Cheers,
            >> Graham
            >>
            >>
            >> ------------------------------------------------------------------------------
            >> The Planet: dedicated and managed hosting, cloud storage, colocation
            >> Stay online with enterprise data centers and the best network in the business
            >> Choose flexible plans and management services without long-term contracts
            >> Personal 24x7 support from experience hosting pros just a phone call away.
            >> http://p.sf.net/sfu/theplanet-com
            >> _______________________________________________
            >> Cheetahtemplate-discuss mailing list
            >> Cheetahtemplate-discuss@...
            >> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            > Cheers,
            > -R. Tyler Ballance
            > --------------------------------------
            > Jabber: rtyler@...
            > GitHub: http://github.com/rtyler
            > Twitter: http://twitter.com/agentdero
            > Blog: http://unethicalblogger.com
            >
            >

            ------------------------------------------------------------------------------
            The Planet: dedicated and managed hosting, cloud storage, colocation
            Stay online with enterprise data centers and the best network in the business
            Choose flexible plans and management services without long-term contracts
            Personal 24x7 support from experience hosting pros just a phone call away.
            http://p.sf.net/sfu/theplanet-com
            _______________________________________________
            Cheetahtemplate-discuss mailing list
            Cheetahtemplate-discuss@...
            https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
          • R. Tyler Ballance
            ... After removing the WebWare legacy imports in Cheetah.Servlet, I think you should see a speed-up in import-time on your machine. Would you mind grabbing a
            Message 5 of 24 , Jan 27, 2010
            • 0 Attachment
              On Wed, 27 Jan 2010, Matthew Beauregard wrote:

              > Hi,
              >
              > I was trying to speed up my CGI, and I worked out that the lion's share of execution time was taken up by the Cheetah import. Is 0.7s unusually slow? Where should I start in trying to speed it up?

              After removing the WebWare legacy imports in Cheetah.Servlet, I think you
              should see a speed-up in import-time on your machine. Would you mind grabbing a
              tarball from GitHub [1] and testing it for me (I don't have a Mac handy) to
              verify the fix?

              If this is a big issue for you, I can push my baking v2.4.2 release to pypi.

              [1] http://github.com/rtyler/cheetah/tarball/v2.4.2rc1

              Cheers,
              -R. Tyler Ballance
              --------------------------------------
              Jabber: rtyler@...
              GitHub: http://github.com/rtyler
              Twitter: http://twitter.com/agentdero
              Blog: http://unethicalblogger.com
            • Matthew Beauregard
              ... That s done the trick, thanks! I m very happy with that tarball, no need to change release schedules on my account. thanks, Matthew ... The Planet:
              Message 6 of 24 , Jan 31, 2010
              • 0 Attachment
                On 28/01/2010, at 3:48 PM, R. Tyler Ballance wrote:

                >
                > On Wed, 27 Jan 2010, Matthew Beauregard wrote:
                >
                >> Hi,
                >>
                >> I was trying to speed up my CGI, and I worked out that the lion's share of execution time was taken up by the Cheetah import. Is 0.7s unusually slow? Where should I start in trying to speed it up?
                >
                > After removing the WebWare legacy imports in Cheetah.Servlet, I think you
                > should see a speed-up in import-time on your machine. Would you mind grabbing a
                > tarball from GitHub [1] and testing it for me (I don't have a Mac handy) to
                > verify the fix?

                That's done the trick, thanks!

                I'm very happy with that tarball, no need to change release schedules on my account.

                thanks,
                Matthew
                ------------------------------------------------------------------------------
                The Planet: dedicated and managed hosting, cloud storage, colocation
                Stay online with enterprise data centers and the best network in the business
                Choose flexible plans and management services without long-term contracts
                Personal 24x7 support from experience hosting pros just a phone call away.
                http://p.sf.net/sfu/theplanet-com
                _______________________________________________
                Cheetahtemplate-discuss mailing list
                Cheetahtemplate-discuss@...
                https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
              • R. Tyler Ballance
                ... Heh, no worries another release is due fairly soon anyways since I ve got a couple bugfixes and refactorings in `next` branch for v2.4.2; having a good
                Message 7 of 24 , Jan 31, 2010
                • 0 Attachment
                  On Mon, 01 Feb 2010, Matthew Beauregard wrote:

                  >
                  > On 28/01/2010, at 3:48 PM, R. Tyler Ballance wrote:
                  >
                  > >
                  > > On Wed, 27 Jan 2010, Matthew Beauregard wrote:
                  > >
                  > >> Hi,
                  > >>
                  > >> I was trying to speed up my CGI, and I worked out that the lion's share of execution time was taken up by the Cheetah import. Is 0.7s unusually slow? Where should I start in trying to speed it up?
                  > >
                  > > After removing the WebWare legacy imports in Cheetah.Servlet, I think you
                  > > should see a speed-up in import-time on your machine. Would you mind grabbing a
                  > > tarball from GitHub [1] and testing it for me (I don't have a Mac handy) to
                  > > verify the fix?
                  >
                  > That's done the trick, thanks!
                  >
                  > I'm very happy with that tarball, no need to change release schedules on my account.

                  Heh, no worries another release is due fairly soon anyways since I've got a
                  couple bugfixes and refactorings in `next` branch for v2.4.2; having a good
                  performance improvement for Mac users is just a little extra icing :)

                  Cheers,
                  -R. Tyler Ballance
                  --------------------------------------
                  Jabber: rtyler@...
                  GitHub: http://github.com/rtyler
                  Twitter: http://twitter.com/agentdero
                  Blog: http://unethicalblogger.com
                • Matthew Beauregard
                  ... I just tested this on a 10.5 Mac running Python 2.5.1 and got the following exception: /Library/Python/2.5/site-packages/Cheetah-2.4.2-py2.5.egg/Cheetah/
                  Message 8 of 24 , Feb 1 5:27 PM
                  • 0 Attachment

                    On 28/01/2010, at 3:48 PM, R. Tyler Ballance wrote:


                    On Wed, 27 Jan 2010, Matthew Beauregard wrote:

                    Hi,

                    I was trying to speed up my CGI, and I worked out that the lion's share of execution time was taken up by the Cheetah import.  Is 0.7s unusually slow?  Where should I start in trying to speed it up?

                    After removing the WebWare legacy imports in Cheetah.Servlet, I think you
                    should see a speed-up in import-time on your machine. Would you mind grabbing a
                    tarball from GitHub [1] and testing it for me (I don't have a Mac handy) to
                    verify the fix?

                    I just tested this on a 10.5 Mac running Python 2.5.1 and got the following exception:

                     /Library/Python/2.5/site-packages/Cheetah-2.4.2-py2.5.egg/Cheetah/NameMapper.py in _isInstanceOrClass(obj=<bound method Member.onLoads of <__main__.Member object at 0x1abd890>>)
                      190 
                      191 def _isInstanceOrClass(obj):
                      192     if type(obj) in (InstanceType, ClassType):
                      193         # oldstyle
                      194         return True
                    builtin type = <type 'type'>, obj = <bound method Member.onLoads of <__main__.Member object at 0x1abd890>>, InstanceType undefined, ClassType undefined

                    <type 'exceptions.NameError'>: global name 'InstanceType' is not defined   


                    I chucked in a "from types import InstanceType, ClassType" at the top of the file, which has got me going, but it might need looking at?


                    thanks,

                    Matthew



                  • R. Tyler Ballance
                    ... Very good, but you re about a day late ;) http://github.com/rtyler/cheetah/commit/62f5a2fe995695c1a88cef5e059192b20143afe0 Your workaround is fine, but you
                    Message 9 of 24 , Feb 1 5:35 PM
                    • 0 Attachment
                      On Tue, 02 Feb 2010, Matthew Beauregard wrote:

                      >
                      > On 28/01/2010, at 3:48 PM, R. Tyler Ballance wrote:
                      >
                      > >
                      > >On Wed, 27 Jan 2010, Matthew Beauregard wrote:
                      > >
                      > >>Hi,
                      > >>
                      > >>I was trying to speed up my CGI, and I worked out that the
                      > >>lion's share of execution time was taken up by the Cheetah
                      > >>import. Is 0.7s unusually slow? Where should I start in trying
                      > >>to speed it up?
                      > >
                      > >After removing the WebWare legacy imports in Cheetah.Servlet, I
                      > >think you
                      > >should see a speed-up in import-time on your machine. Would you
                      > >mind grabbing a
                      > >tarball from GitHub [1] and testing it for me (I don't have a Mac
                      > >handy) to
                      > >verify the fix?
                      >
                      > I just tested this on a 10.5 Mac running Python 2.5.1 and got the
                      > following exception:
                      >
                      > /Library/Python/2.5/site-packages/Cheetah-2.4.2-py2.5.egg/Cheetah/
                      > NameMapper.py in _isInstanceOrClass(obj=<bound method Member.onLoads
                      > of <__main__.Member object at 0x1abd890>>)

                      Very good, but you're about a day late ;)

                      http://github.com/rtyler/cheetah/commit/62f5a2fe995695c1a88cef5e059192b20143afe0

                      Your workaround is fine, but you might want to look into why you're not using
                      the compiled namemapper

                      Cheers,
                      -R. Tyler Ballance
                      --------------------------------------
                      Jabber: rtyler@...
                      GitHub: http://github.com/rtyler
                      Twitter: http://twitter.com/agentdero
                      Blog: http://unethicalblogger.com
                    • Matthew Beauregard
                      ... Actually, yeah, that s just bit me. There is (and has been for years) a difference between the C and Python NameMappers that my code triggers so parts of
                      Message 10 of 24 , Feb 1 6:58 PM
                      • 0 Attachment
                        > Your workaround is fine, but you might want to look into why you're
                        > not using
                        > the compiled namemapper

                        Actually, yeah, that's just bit me. There is (and has been for years)
                        a difference between the C and Python NameMappers that my code
                        triggers so parts of it only work with the C mapper. That's been fine
                        until now when I'm trying to build from git/next.

                        From what I can see the compiled mapper isn't building right for me:

                        gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-
                        madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -
                        DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -
                        I/System/Library/Frameworks/Python.framework/Versions/2.5/include/
                        python2.5 -c cheetah/c/_namemapper.c -o build/temp.macosx-10.5-
                        i386-2.5/cheetah/c/_namemapper.o
                        cheetah/c/_namemapper.c: In function ‘setNotFoundException’:
                        cheetah/c/_namemapper.c:38: warning: implicit declaration of function
                        ‘PyUnicode_FromFormat’
                        cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                        integer without a cast
                        cheetah/c/_namemapper.c: In function ‘setNotFoundException’:
                        cheetah/c/_namemapper.c:38: warning: implicit declaration of function
                        ‘PyUnicode_FromFormat’
                        cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                        integer without a cast
                        cheetah/c/_namemapper.c: In function ‘wrapInternalNotFoundException’:
                        cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                        integer without a cast
                        cheetah/c/_namemapper.c: In function ‘wrapInternalNotFoundException’:
                        cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                        integer without a cast

                        So then I get:

                        >>> from Cheetah._namemapper import NotFound, valueForKey, valueForName
                        Traceback (most recent call last):
                        File "<stdin>", line 1, in <module>
                        ImportError: dlopen(/Library/Python/2.5/site-packages/Cheetah-2.4.2-
                        py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so, 2): Symbol not
                        found: _PyUnicode_FromFormat
                        Referenced from: /Library/Python/2.5/site-packages/Cheetah-2.4.2-
                        py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so
                        Expected in: dynamic lookup

                        thanks,
                        Matthew


                        ------------------------------------------------------------------------------
                        The Planet: dedicated and managed hosting, cloud storage, colocation
                        Stay online with enterprise data centers and the best network in the business
                        Choose flexible plans and management services without long-term contracts
                        Personal 24x7 support from experience hosting pros just a phone call away.
                        http://p.sf.net/sfu/theplanet-com
                        _______________________________________________
                        Cheetahtemplate-discuss mailing list
                        Cheetahtemplate-discuss@...
                        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                      • R. Tyler Ballance
                        ... Ah yes indeed, this is another thing I ve messed up in the next branch and haven t had a chance to fix yet :) I made a good chunk of changes without
                        Message 11 of 24 , Feb 1 7:53 PM
                        • 0 Attachment
                          On Tue, 02 Feb 2010, Matthew Beauregard wrote:

                          > >Your workaround is fine, but you might want to look into why
                          > >you're not using
                          > >the compiled namemapper
                          >
                          > Actually, yeah, that's just bit me. There is (and has been for
                          > years) a difference between the C and Python NameMappers that my
                          > code triggers so parts of it only work with the C mapper. That's
                          > been fine until now when I'm trying to build from git/next.

                          Ah yes indeed, this is another thing I've messed up in the next branch and
                          haven't had a chance to fix yet :)

                          I made a good chunk of changes without checking Hudson to see how they were
                          performing on other versions of Python and other platforms. This past weekend I
                          went back to Hudson and realized my error.

                          You can check out the current build results here:
                          http://avocado.monkeypox.org:8080/job/Cheetah_next/

                          My apologies, I typically work under Python 2.6 so I was completely oblivious
                          to the breakages on Python 2.4 and 2.5

                          I'll probably fix it tonight or tomorrow sometime; I'll update the thread when
                          it's there

                          >
                          > From what I can see the compiled mapper isn't building right for me:
                          >
                          > gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
                          > -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall
                          > -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE
                          > -arch i386 -arch ppc -pipe -
                          > I/System/Library/Frameworks/Python.framework/Versions/2.5/include/
                          > python2.5 -c cheetah/c/_namemapper.c -o build/temp.macosx-10.5-
                          > i386-2.5/cheetah/c/_namemapper.o
                          > cheetah/c/_namemapper.c: In function ?setNotFoundException?:
                          > cheetah/c/_namemapper.c:38: warning: implicit declaration of
                          > function ?PyUnicode_FromFormat?
                          > cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                          > integer without a cast
                          > cheetah/c/_namemapper.c: In function ?setNotFoundException?:
                          > cheetah/c/_namemapper.c:38: warning: implicit declaration of
                          > function ?PyUnicode_FromFormat?
                          > cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                          > integer without a cast
                          > cheetah/c/_namemapper.c: In function ?wrapInternalNotFoundException?:
                          > cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                          > integer without a cast
                          > cheetah/c/_namemapper.c: In function ?wrapInternalNotFoundException?:
                          > cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                          > integer without a cast
                          >
                          > So then I get:
                          >
                          > >>> from Cheetah._namemapper import NotFound, valueForKey, valueForName
                          > Traceback (most recent call last):
                          > File "<stdin>", line 1, in <module>
                          > ImportError: dlopen(/Library/Python/2.5/site-packages/Cheetah-2.4.2-
                          > py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so, 2): Symbol not
                          > found: _PyUnicode_FromFormat
                          > Referenced from: /Library/Python/2.5/site-packages/Cheetah-2.4.2-
                          > py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so
                          > Expected in: dynamic lookup
                          >
                          > thanks,
                          > Matthew
                          >
                          Cheers,
                          -R. Tyler Ballance
                          --------------------------------------
                          Jabber: rtyler@...
                          GitHub: http://github.com/rtyler
                          Twitter: http://twitter.com/agentdero
                          Blog: http://unethicalblogger.com
                        • Michael Higgins
                          Just downloaded the tarball from http://pypi.python.org/pypi/Cheetah/2.4.2.1 and I m seeing similar compile problems to the ones reported below. I m on OS X
                          Message 12 of 24 , Mar 9, 2010
                          • 0 Attachment
                            Just downloaded the tarball from http://pypi.python.org/pypi/Cheetah/2.4.2.1
                            and I'm seeing similar compile problems to the ones reported below.

                            I'm on OS X 10.5.8, using python 2.5.1. When I unpack the tarball and
                            do python setup.py build, it spits out this:

                            ...
                            building 'Cheetah._namemapper' extension
                            creating build/temp.macosx-10.5-i386-2.5
                            creating build/temp.macosx-10.5-i386-2.5/cheetah
                            creating build/temp.macosx-10.5-i386-2.5/cheetah/c
                            gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-
                            madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -
                            DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -
                            I/System/Library/Frameworks/Python.framework/Versions/2.5/include/
                            python2.5 -c cheetah/c/_namemapper.c -o build/temp.macosx-10.5-
                            i386-2.5/cheetah/c/_namemapper.o
                            cheetah/c/_namemapper.c: In function ‘setNotFoundException’:
                            cheetah/c/_namemapper.c:38: warning: implicit declaration of function
                            ‘PyUnicode_FromFormat’
                            cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                            integer without a castcheetah/c/_namemapper.c: In function
                            ‘setNotFoundException’:
                            cheetah/c/_namemapper.c:38: warning: implicit declaration of function
                            ‘PyUnicode_FromFormat’
                            cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                            integer without a cast

                            cheetah/c/_namemapper.c: In function
                            ‘wrapInternalNotFoundException’:cheetah/c/_namemapper.c: In function
                            ‘wrapInternalNotFoundException’:
                            cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                            integer without a cast
                            cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                            integer without a cast

                            gcc -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc
                            build/temp.macosx-10.5-i386-2.5/cheetah/c/_namemapper.o -o build/
                            lib.macosx-10.5-i386-2.5/Cheetah/_namemapper.so
                            ...

                            and then the C version of the namemapper doesn't import because of
                            missing symbols.

                            Is there another build out there that fixes this, or is it still in
                            the pipeline?

                            (And thanks for all your hard work! Cheetah is great!)

                            Mike



                            On Feb 1, 2010, at 10:53 PM, R. Tyler Ballance wrote:

                            >
                            > On Tue, 02 Feb 2010, Matthew Beauregard wrote:
                            >
                            >>> Your workaround is fine, but you might want to look into why
                            >>> you're not using
                            >>> the compiled namemapper
                            >>
                            >> Actually, yeah, that's just bit me. There is (and has been for
                            >> years) a difference between the C and Python NameMappers that my
                            >> code triggers so parts of it only work with the C mapper. That's
                            >> been fine until now when I'm trying to build from git/next.
                            >
                            > Ah yes indeed, this is another thing I've messed up in the next
                            > branch and
                            > haven't had a chance to fix yet :)
                            >
                            > I made a good chunk of changes without checking Hudson to see how
                            > they were
                            > performing on other versions of Python and other platforms. This
                            > past weekend I
                            > went back to Hudson and realized my error.
                            >
                            > You can check out the current build results here:
                            > http://avocado.monkeypox.org:8080/job/Cheetah_next/
                            >
                            > My apologies, I typically work under Python 2.6 so I was completely
                            > oblivious
                            > to the breakages on Python 2.4 and 2.5
                            >
                            > I'll probably fix it tonight or tomorrow sometime; I'll update the
                            > thread when
                            > it's there
                            >
                            >>
                            >> From what I can see the compiled mapper isn't building right for me:
                            >>
                            >> gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
                            >> -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall
                            >> -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE
                            >> -arch i386 -arch ppc -pipe -
                            >> I/System/Library/Frameworks/Python.framework/Versions/2.5/include/
                            >> python2.5 -c cheetah/c/_namemapper.c -o build/temp.macosx-10.5-
                            >> i386-2.5/cheetah/c/_namemapper.o
                            >> cheetah/c/_namemapper.c: In function ?setNotFoundException?:
                            >> cheetah/c/_namemapper.c:38: warning: implicit declaration of
                            >> function ?PyUnicode_FromFormat?
                            >> cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                            >> integer without a cast
                            >> cheetah/c/_namemapper.c: In function ?setNotFoundException?:
                            >> cheetah/c/_namemapper.c:38: warning: implicit declaration of
                            >> function ?PyUnicode_FromFormat?
                            >> cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                            >> integer without a cast
                            >> cheetah/c/_namemapper.c: In function ?wrapInternalNotFoundException?:
                            >> cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                            >> integer without a cast
                            >> cheetah/c/_namemapper.c: In function ?wrapInternalNotFoundException?:
                            >> cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                            >> integer without a cast
                            >>
                            >> So then I get:
                            >>
                            >>>>> from Cheetah._namemapper import NotFound, valueForKey,
                            >>>>> valueForName
                            >> Traceback (most recent call last):
                            >> File "<stdin>", line 1, in <module>
                            >> ImportError: dlopen(/Library/Python/2.5/site-packages/Cheetah-2.4.2-
                            >> py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so, 2): Symbol not
                            >> found: _PyUnicode_FromFormat
                            >> Referenced from: /Library/Python/2.5/site-packages/Cheetah-2.4.2-
                            >> py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so
                            >> Expected in: dynamic lookup
                            >>
                            >> thanks,
                            >> Matthew
                            >>
                            > Cheers,
                            > -R. Tyler Ballance
                            > --------------------------------------
                            > Jabber: rtyler@...
                            > GitHub: http://github.com/rtyler
                            > Twitter: http://twitter.com/agentdero
                            > Blog: http://unethicalblogger.com
                            >
                            > ------------------------------------------------------------------------------
                            > The Planet: dedicated and managed hosting, cloud storage, colocation
                            > Stay online with enterprise data centers and the best network in the
                            > business
                            > Choose flexible plans and management services without long-term
                            > contracts
                            > Personal 24x7 support from experience hosting pros just a phone call
                            > away.
                            > http://p.sf.net/sfu/theplanet-com_______________________________________________
                            > Cheetahtemplate-discuss mailing list
                            > Cheetahtemplate-discuss@...
                            > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss


                            ------------------------------------------------------------------------------
                            Download Intel® Parallel Studio Eval
                            Try the new software tools for yourself. Speed compiling, find bugs
                            proactively, and fine-tune applications for parallel performance.
                            See why Intel Parallel Studio got high marks during beta.
                            http://p.sf.net/sfu/intel-sw-dev
                            _______________________________________________
                            Cheetahtemplate-discuss mailing list
                            Cheetahtemplate-discuss@...
                            https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                          • R. Tyler Ballance
                            ... Looks like this is another error I ve missed in the builds since we fall back to the pure Python Namemapper in case of error (relevant build output:
                            Message 13 of 24 , Mar 9, 2010
                            • 0 Attachment
                              On Tue, 09 Mar 2010, Michael Higgins wrote:

                              > Just downloaded the tarball from
                              > http://pypi.python.org/pypi/Cheetah/2.4.2.1 and I'm seeing similar
                              > compile problems to the ones reported below.
                              >
                              > I'm on OS X 10.5.8, using python 2.5.1. When I unpack the tarball
                              > and do python setup.py build, it spits out this:
                              >
                              > ...
                              > building 'Cheetah._namemapper' extension
                              > creating build/temp.macosx-10.5-i386-2.5
                              > creating build/temp.macosx-10.5-i386-2.5/cheetah
                              > creating build/temp.macosx-10.5-i386-2.5/cheetah/c
                              > gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
                              > -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall
                              > -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE
                              > -arch i386 -arch ppc -pipe -
                              > I/System/Library/Frameworks/Python.framework/Versions/2.5/include/
                              > python2.5 -c cheetah/c/_namemapper.c -o build/temp.macosx-10.5-
                              > i386-2.5/cheetah/c/_namemapper.o
                              > cheetah/c/_namemapper.c: In function ?setNotFoundException?:
                              > cheetah/c/_namemapper.c:38: warning: implicit declaration of
                              > function ?PyUnicode_FromFormat?
                              > cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                              > integer without a castcheetah/c/_namemapper.c: In function
                              > ?setNotFoundException?:
                              > cheetah/c/_namemapper.c:38: warning: implicit declaration of
                              > function ?PyUnicode_FromFormat?
                              > cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                              > integer without a cast
                              >
                              > cheetah/c/_namemapper.c: In function
                              > ?wrapInternalNotFoundException?:cheetah/c/_namemapper.c: In function
                              > ?wrapInternalNotFoundException?:
                              > cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                              > integer without a cast
                              > cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                              > integer without a cast
                              >
                              > gcc -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc
                              > build/temp.macosx-10.5-i386-2.5/cheetah/c/_namemapper.o -o build/
                              > lib.macosx-10.5-i386-2.5/Cheetah/_namemapper.so
                              > ...
                              >
                              > and then the C version of the namemapper doesn't import because of
                              > missing symbols.


                              Looks like this is another error I've missed in the builds since we fall back
                              to the pure Python Namemapper in case of error (relevant build output:
                              http://hudson.brokenco.de/job/Cheetah__Next/label=Mac,namemapper=purepython,python=python25/19/console
                              )

                              I'll take a look at this this evening if I have the bandwidth :)

                              >
                              > Is there another build out there that fixes this, or is it still in
                              > the pipeline?
                              >
                              > (And thanks for all your hard work! Cheetah is great!)
                              >
                              > Mike
                              >
                              >
                              >
                              > On Feb 1, 2010, at 10:53 PM, R. Tyler Ballance wrote:
                              >
                              > >
                              > >On Tue, 02 Feb 2010, Matthew Beauregard wrote:
                              > >
                              > >>>Your workaround is fine, but you might want to look into why
                              > >>>you're not using
                              > >>>the compiled namemapper
                              > >>
                              > >>Actually, yeah, that's just bit me. There is (and has been for
                              > >>years) a difference between the C and Python NameMappers that my
                              > >>code triggers so parts of it only work with the C mapper. That's
                              > >>been fine until now when I'm trying to build from git/next.
                              > >
                              > >Ah yes indeed, this is another thing I've messed up in the next
                              > >branch and
                              > >haven't had a chance to fix yet :)
                              > >
                              > >I made a good chunk of changes without checking Hudson to see how
                              > >they were
                              > >performing on other versions of Python and other platforms. This
                              > >past weekend I
                              > >went back to Hudson and realized my error.
                              > >
                              > >You can check out the current build results here:
                              > > http://avocado.monkeypox.org:8080/job/Cheetah_next/
                              > >
                              > >My apologies, I typically work under Python 2.6 so I was
                              > >completely oblivious
                              > >to the breakages on Python 2.4 and 2.5
                              > >
                              > >I'll probably fix it tonight or tomorrow sometime; I'll update the
                              > >thread when
                              > >it's there
                              > >
                              > >>
                              > >>From what I can see the compiled mapper isn't building right for me:
                              > >>
                              > >>gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
                              > >>-mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall
                              > >>-Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE
                              > >>-arch i386 -arch ppc -pipe -
                              > >>I/System/Library/Frameworks/Python.framework/Versions/2.5/include/
                              > >>python2.5 -c cheetah/c/_namemapper.c -o build/temp.macosx-10.5-
                              > >>i386-2.5/cheetah/c/_namemapper.o
                              > >>cheetah/c/_namemapper.c: In function ?setNotFoundException?:
                              > >>cheetah/c/_namemapper.c:38: warning: implicit declaration of
                              > >>function ?PyUnicode_FromFormat?
                              > >>cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                              > >>integer without a cast
                              > >>cheetah/c/_namemapper.c: In function ?setNotFoundException?:
                              > >>cheetah/c/_namemapper.c:38: warning: implicit declaration of
                              > >>function ?PyUnicode_FromFormat?
                              > >>cheetah/c/_namemapper.c:38: warning: assignment makes pointer from
                              > >>integer without a cast
                              > >>cheetah/c/_namemapper.c: In function ?wrapInternalNotFoundException?:
                              > >>cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                              > >>integer without a cast
                              > >>cheetah/c/_namemapper.c: In function ?wrapInternalNotFoundException?:
                              > >>cheetah/c/_namemapper.c:62: warning: assignment makes pointer from
                              > >>integer without a cast
                              > >>
                              > >>So then I get:
                              > >>
                              > >>>>>from Cheetah._namemapper import NotFound, valueForKey,
                              > >>>>>valueForName
                              > >>Traceback (most recent call last):
                              > >> File "<stdin>", line 1, in <module>
                              > >>ImportError: dlopen(/Library/Python/2.5/site-packages/Cheetah-2.4.2-
                              > >>py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so, 2): Symbol not
                              > >>found: _PyUnicode_FromFormat
                              > >> Referenced from: /Library/Python/2.5/site-packages/Cheetah-2.4.2-
                              > >>py2.5-macosx-10.5-i386.egg/Cheetah/_namemapper.so
                              > >> Expected in: dynamic lookup
                              > >>
                              > >>thanks,
                              > >>Matthew
                              > >>
                              > >Cheers,
                              > >-R. Tyler Ballance
                              > >--------------------------------------
                              > >Jabber: rtyler@...
                              > >GitHub: http://github.com/rtyler
                              > >Twitter: http://twitter.com/agentdero
                              > > Blog: http://unethicalblogger.com
                              > >
                              > >------------------------------------------------------------------------------
                              > >The Planet: dedicated and managed hosting, cloud storage, colocation
                              > >Stay online with enterprise data centers and the best network in
                              > >the business
                              > >Choose flexible plans and management services without long-term
                              > >contracts
                              > >Personal 24x7 support from experience hosting pros just a phone
                              > >call away.
                              > >http://p.sf.net/sfu/theplanet-com_______________________________________________
                              > >Cheetahtemplate-discuss mailing list
                              > >Cheetahtemplate-discuss@...
                              > >https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                              >
                              Cheers,
                              -R. Tyler Ballance
                              --------------------------------------
                              Jabber: rtyler@...
                              GitHub: http://github.com/rtyler
                              Twitter: http://twitter.com/agentdero
                              Blog: http://unethicalblogger.com
                            Your message has been successfully submitted and would be delivered to recipients shortly.