Python shared libraries - Cheetah namemapper.so not found -


i'm using python cheetah template generation , can't use compiled _namemapper.so library installed. running on centos 5.4 python 2.4 installed, using cheetah 2.4.3. cannot life of me cheetah use _namemapper.so file built during install:

filling conf/asterisk/sip.conf.ect -> conf/asterisk/sip.conf ... /usr/lib64/python2.4/site-packages/cheetah/compiler.py:1508: userwarning:  don't have c version of namemapper installed! i'm disabling cheetah's  usestackframes option painfully slow python version of namemapper.  should copy of cheetah compiled c version of namemapper. 

however, have shared library sitting right next namemapper modules:

$ ls -ltr /usr/lib64/python2.4/site-packages/cheetah/ | grep -i namemap -rw-r--r-- 1 root root  12376 jul  1 20:17 namemapper.py -rwxr-xr-x 1 root root  36982 dec  1 09:55 _namemapper.so -rw-r--r-- 1 root root  12541 dec  1 09:55 namemapper.pyc 

i've tried adding directory /etc/ld.so.conf.d/python-cheetah.conf, , _namemapper.so shared library not found.

any ideas?

solved

thanks @alex-b. turns out had compiled cheetah on 32-bit machine , attempting load shared library on 64-bit machine. d'oh!

>>> cheetah._namemapper import notfound traceback (most recent call last):   file "<stdin>", line 1, in ? importerror: /usr/lib/python2.4/site-packages/cheetah/_namemapper.so: wrong elf class: elfclass32 

then ran next problem:

>>> cheetah._namemapper import notfound traceback (most recent call last):   file "<stdin>", line 1, in ? importerror: /usr/lib/python2.4/site-packages/cheetah/_namemapper.so: undefined symbol: pyunicode_fromformat 

and turns out cheetah doesn't work on python <= 2.6, upgrading.

  1. make sure _namemapper.so in 1 of paths in sys.path when script invoked. it's possible misconfigured (can python installed somewhere, example, in home directory).

    import sys sys.path 
  2. if library indeed loaded, try checking if it's of correct version. seems cheetah tries load particular functions _namemapper (utils/namemapper.py:288):

    try:     _namemapper import notfound, valueforkey, valueforname, \          valuefromsearchlist, valuefromframeorsearchlist, valuefromframe     c_version = true except:     c_version = false 

    if fails, c_version set false, gives warning. try importing these symbols _namemapper yourself, may _namemapper.so version wrong.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -