Does anyone know where i can find this python module ‘contextlib’?
root@overo:~# python
Python 2.6.6 (r266:84292, Mar 9 2011, 10:05:36)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import contextlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named contextlib
I did not compile python myself personally. I’m just in this mess. It’s running on an ARM based CPU so maybe some things were left out to save space.
I ran find / | grep contextlib which resulted in nothing.
Can i download this module from somewhere and just plonk it in /usr/lib/python2.6? Will that work?
As others have noted, that module should be in the standard library, but if it’s an embedded device, it may have been dropped to save space (if true, a foolish choice IMO, since leaving out
contextlib.contextmanagerrobs thewithstatement of much of its power and convenience)If you can name the specific device or manufacturer (or ask the vendor directly), you may be able to get a better answer.
As far as fixing it goes, grabbing http://hg.python.org/cpython/file/2.6/Lib/contextlib.py and dropping it in
sys.pathsomewhere should do the trick (runningpython -m sitewill dump the list of directories that you can use)