[mod_python] file() constructor not accessible in restricted mode

Martin MOKREJŠ mmokrejs at ribosome.natur.cuni.cz
Tue Jul 5 09:41:44 EDT 2005

python-2.3.4, mod_python as of today from svn tree, cElementTree-1.0.2-20050302,
elementtree-1.2.6-20050316. No PythonHandler installed in httpd.conf,
only in .htaccess.

I get the error reproducibly upon cElementTree use when I either set or unset
PythonInterpPerDirectory On
in .htaccess without restarting apache (I mean I just comment out the line
or remove the `#').

When I switch to ElementTree I can comment and uncomment the line in .htaccess
as many times as I wish and do not have to restart apache. Probably it relates to
the fact the python modules written in Ansi C are cached ...
In real world life this test doesn't make much sense but I just believe
something similar maybe happened to me in other situations. At least the error
message is same. A short testcase is included.

cElementTree and elementTree were configured to use python2.3 at the same time.
Also mod_python was configured to use python2.3.

aquarius mysql # ldd /usr/lib/python2.3/site-packages/cElementTree.so 
        linux-gate.so.1 =>  (0xffffe000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7eda000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb7dc6000)
        /lib/ld-linux.so.2 (0x80000000)
aquarius mysql # ldd /usr/sbin/apache2
        linux-gate.so.1 =>  (0xffffe000)
        libz.so.1 => /lib/libz.so.1 (0xb7f56000)
        libssl.so.0.9.7 => /usr/lib/libssl.so.0.9.7 (0xb7f26000)
        libcrypto.so.0.9.7 => /usr/lib/libcrypto.so.0.9.7 (0xb7e25000)
        libaprutil-0.so.0 => /usr/lib/libaprutil-0.so.0 (0xb7e0c000)
        libgdbm.so.3 => /usr/lib/libgdbm.so.3 (0xb7e05000)
        libdb-4.2.so => /usr/lib/libdb-4.2.so (0xb7d1f000)
        libexpat.so.0 => /usr/lib/libexpat.so.0 (0xb7cf0000)
        libapr-0.so.0 => /usr/lib/libapr-0.so.0 (0xb7ccc000)
        librt.so.1 => /lib/tls/librt.so.1 (0xb7cc3000)
        libm.so.6 => /lib/tls/libm.so.6 (0xb7ca1000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7c74000)
        libnsl.so.1 => /lib/libnsl.so.1 (0xb7c5f000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7c4c000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7c48000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb7b34000)
        /lib/ld-linux.so.2 (0xb7f92000)
aquarius mysql # ldd /usr/lib/apache2/modules/mod_python.so 
        linux-gate.so.1 =>  (0xffffe000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7e5e000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7e5a000)
        libutil.so.1 => /lib/libutil.so.1 (0xb7e56000)
        libm.so.6 => /lib/tls/libm.so.6 (0xb7e34000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb7d20000)
        /lib/ld-linux.so.2 (0x80000000)
aquarius mysql # 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: index_conference.py
Type: text/x-python
Size: 927 bytes
Desc: not available
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050705/504198e8/index_conference.py
-------------- next part --------------
AddHandler mod_python .py
PythonHandler mod_python.publisher
#PythonHandler mod_python.testhandler
#PythonInterpPerDirectory On
PythonDebug On

<IfModule mod_dir.c>
    DirectoryIndex index_conference.py

Options -Indexes

More information about the Mod_python mailing list