Re: Importing Cheetah.Template.Template unusually slow?

Matthew Beauregard <[email protected]> Tue, 2 Feb 2010 13:58:20 +1100
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
> 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