Where can I get and how to install _namemapper.pyd for Python 2.7 on Windows

I have Python 2.7 installed on my Windows system with Cheetah. The following is the error I get when I try to use the cheetah.template object with a .tmpl file.

from Cheetah.Template import Template t = Template(file='home.tmpl') C:\wamp\bin\Python27\lib\site-packages\Cheetah\Compiler.py:1509: UserWarning: You don't have the C version of NameMapper installed! I'm disabling Cheetah us eStackFrames option as it is painfully slow with the Python version of NameMappe r. You should get a copy of Cheetah with the compiled C version of NameMapper. "\nYou don't have the C version of NameMapper installed! " from Cheetah.Template import Template t = Template(file='home.tmpl') print t Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\wamp\bin\Python27\lib\site-packages\Cheetah\Template.py", line 1005, in __str__ rc = getattr(self, mainMethName)() File "_wamp_www_b121pyraw_b121pycheetah_home_tmpl.py", line 89, in respond File "C:\wamp\bin\Python27\lib\site-packages\Cheetah\NameMapper.py", line 246, in valueFromSearchList _raiseNotFoundException(key, searchList) File "C:\wamp\bin\Python27\lib\site-packages\Cheetah\NameMapper.py", line 167, in _raiseNotFoundException raise NotFound(excString) Cheetah.NameMapper.NotFound: cannot find 'firstdivcontents' 

I searched for _namemapper.pyd for python 2.7, but I am not getting. I found the file only for version 2.6. Do I need to upgrade to python 2.6, or is there any other way to install it.

And also how to install _namemapper.pyd to work with python, if at all, will I find it?

+4
source share
3 answers

Pyd files are created by compiling the C files that come with the package. This is done during installation if you have a C compiler. If not, you will get Python in this case. Some packages will simply refuse to install.

The solution for Windows people without a C compiler is to install pre-compiled binary C packages. It seems that the cheetah did not have: http://pypi.python.org/pypi/Cheetah/2.4.4

So, you will need to install the C compiler. MinGW is a good option, I hear.

However, I do not think this is your problem. Your actual error does not seem to have anything to do with this warning.

So, if you include your bad code, people who are more used to Cheetah than I can probably tell you what is wrong.

+3
source

File C:\Python27\Lib\site-packages\Cheetah\Compiler.py

Comment on the following lines starting with line # 1506 to get rid of the error.

 # if not NameMapper.C_VERSION: # if not sys.platform.startswith('java'): # warnings.warn( # "\nYou don't have the C version of NameMapper installed! " # "I'm disabling Cheetah useStackFrames option as it is " # "painfully slow with the Python version of NameMapper. " # "You should get a copy of Cheetah with the compiled C version of NameMapper." # ) 
-1
source

I made a copy of the python namemapper file, and I solved the problem by simply changing the file extension from _namemapper.pyd to _namemapper.so , and it worked fine.

I can not say that this is the right practice, but it worked for me.

-1
source

Source: https://habr.com/ru/post/1336114/


All Articles