[mod_python] mod_python claims it cannot find a module

Graham Dumpleton grahamd at dscpl.com.au
Tue Jul 5 08:06:33 EDT 2005


Nicolas, you should probably consider running everything through  
cgi.escape() when
sticking stuff into the HTML. For example, Apache configuration uses  
'<...>' and these
aren't being escaped. The HTML doesn't therefore display properly.

Not sure if this will address the weird characters or not.

On 05/07/2005, at 9:58 PM, Martin MOKREJŠ wrote:

>
>
> Graham Dumpleton wrote:
>> On 05/07/2005, at 4:11 PM, Nicolas Lehuen wrote:
>>>
>>>  What I suspect in Martin's case is that req.finfo returns None  
>>> because of the global scope of his PythonHandler configuration, or  
>>> something like that. Therefore, the publisher ends up executing the  
>>> last branch which splits the requested file name into directory +  
>>> func_path and adds index.py to the directory. I'll try to reproduce  
>>> this behaviour and let you know about this.
>> Except that Martin wasn't using your latest version of the publisher,
>> but that in the 3.1.[34] as I understand it, so I don't think you can
>> compare it to what you do now.
>
> I have compiled current svn version of mod_python against python-2.3.4
> to obey the bugs in python-2.3.5 through 2.4.1. To recap the situation,
> I have at the moment NO GLOBAL PythonHandler in httpd.conf, I use
> only .htaccess (aka Directory directive):
>
> # .htaccess:
> AddHandler mod_python .py
> PythonHandler mod_python.publisher
> PythonDebug On
>
> Options -Indexes
>
>
>
> URL: http://aquarius/~mmokrejs/conference/index.py
>
> ERROR:
>
> Mod_python error: "PythonHandler mod_python.publisher"
>
> Traceback (most recent call last):
>
>  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line  
> 299, in HandlerDispatch
>    result = object(req)
>
>  File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line  
> 187, in handler
>    module = page_cache[req]
>
>  File "/usr/lib/python2.3/site-packages/mod_python/cache.py", line 77,  
> in __getitem__
>    return self._checkitem(name)[2]
>
>  File "/usr/lib/python2.3/site-packages/mod_python/cache.py", line  
> 118, in _checkitem
>    opened = self.check(key, name, entry)
>
>  File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line  
> 67, in check
>    return ModuleCache.check(self, key, req, entry)
>
>  File "/usr/lib/python2.3/site-packages/mod_python/cache.py", line  
> 249, in check
>    opened = file(key, self.mode)
>
> IOError: [Errno 2] No such file or directory:  
> '/home/mmokrejs/public_html/conference/index.py'
>
>
>
>
> Alternatively, when I just switch to testhandler under same setup, I  
> get:
>
>
>
>
> AddHandler mod_python .py
> PythonHandler mod_python.testhandler
> PythonDebug On
>
> Options -Indexes
>
> URL: http://aquarius/~mmokrejs/conference/index.py
>
> No error, but output from testhandler is attached. :( I thought it  
> will tell me something else. ;-)
> I think request.notes['ap-mime-exceptions-list'] contains some weird  
> characters, at least while
> viewing this HTMLized output. ;)
> General information
>
> Apache version
> Apache
>
> Apache threaded MPM
> Yes, maximum 25 threads / process
>
> Apache forked MPM
> Yes, maximum 6 processes
>
> Apache server root
> /usr/lib/apache2
>
> Apache document root
> /var/www/localhost/htdocs
>
> Apache error log
> None
>
> Python sys.version
> 2.3.4 (#1, Jul 5 2005, 12:35:17) [GCC 3.4.4 (Gentoo 3.4.4,  
> ssp-3.4.4-1.0, pie-8.7.8)]
>
> Python sys.path
> /home/mmokrejs/public_html/conference/
> /usr/lib/python23.zip
> /usr/lib/python2.3
> /usr/lib/python2.3/plat-linux2
> /usr/lib/python2.3/lib-tk
> /usr/lib/python2.3/lib-dynload
> /usr/lib/portage/pym
> /usr/lib/python2.3/site-packages
>
> Python interpreter name
> aquarius.doma
>
> mod_python.publisher available
> Yes
>
> mod_python.psp available
> Yes
>
> Request input headers
>
> Key
> Value
>
> Host
> aquarius
>
> User-Agent
> Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511
>
> Accept
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/ 
> plain;q=0.8,image/png,*/*;q=0.5
>
> Accept-Language
> cs,en-us;q=0.7,en;q=0.3
>
> Accept-Encoding
> gzip,deflate
>
> Accept-Charset
> ISO-8859-2,utf-8;q=0.7,*;q=0.7
>
> Keep-Alive
> 300
>
> Connection
> keep-alive
>
> Pragma
> no-cache
>
> Cache-Control
> no-cache
>
> Request environment
>
> Key
> Value
>
> GATEWAY_INTERFACE
> CGI/1.1
>
> SERVER_PROTOCOL
> HTTP/1.1
>
> REQUEST_METHOD
> GET
>
> QUERY_STRING
>
> REQUEST_URI
> /~mmokrejs/conference/index.py
>
> SCRIPT_NAME
> /~mmokrejs/conference/index.py
>
> HTTP_HOST
> aquarius
>
> HTTP_USER_AGENT
> Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511
>
> HTTP_ACCEPT
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/ 
> plain;q=0.8,image/png,*/*;q=0.5
>
> HTTP_ACCEPT_LANGUAGE
> cs,en-us;q=0.7,en;q=0.3
>
> HTTP_ACCEPT_ENCODING
> gzip,deflate
>
> HTTP_ACCEPT_CHARSET
> ISO-8859-2,utf-8;q=0.7,*;q=0.7
>
> HTTP_KEEP_ALIVE
> 300
>
> HTTP_CONNECTION
> keep-alive
>
> HTTP_PRAGMA
> no-cache
>
> HTTP_CACHE_CONTROL
> no-cache
>
> PATH
> /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/opt/intel_cc_80/bin:/ 
> usr/local/Acrobat5/bin:/usr/local/mysql/bin:/bin:/usr/bin:/usr/ 
> heimdal/bin:/usr/local/sbin:/usr/local/bin:/usr/afs/bin:/usr/local/ 
> sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686- 
> pc-linux-gnu/gcc-bin/3.4.4:/opt/intel/compiler81/bin:/opt/intel/ 
> compiler70/ia32/bin:/opt/blackdown-jdk-1.4.2.02/bin:/opt/blackdown- 
> jdk-1.4.2.02/jre/bin:/usr/qt/3/bin:/usr/kde/3.4/sbin:/usr/kde/3.4/bin: 
> /usr/kde/3.3/sbin:/usr/kde/3.3/bin:/usr/qt/2/bin:/opt/vmware/bin:/opt/ 
> XnView:/var/qmail/bin
>
> SERVER_SIGNATURE
> Apache Server at aquarius Port 80
>
> SERVER_SOFTWARE
> Apache
>
> SERVER_NAME
> aquarius
>
> SERVER_ADDR
> 192.168.0.11
>
> SERVER_PORT
> 80
>
> REMOTE_ADDR
> 192.168.0.11
>
> DOCUMENT_ROOT
> /var/www/localhost/htdocs
>
> SERVER_ADMIN
> root at localhost
>
> SCRIPT_FILENAME
> /home/mmokrejs/public_html/conference/index.py
>
> REMOTE_PORT
> 50990
>
> Request configuration
>
> Key
> Value
>
> PythonDebug
> 1
>
> Request options
>
> Key
> Value
>
> Request notes
>
> Key
> Value
>
> python_init_ran
> 1
>
> mod_userdir_user
> mmokrejs
>
> ap-mime-exceptions-list
> Ð 
>
> Server configuration
>
> Key
> Value
>
> PythonDebug
> 1
>
> Server configuration tree
> PidFile "/var/run/apache2.pid"
> Timeout 300
> KeepAlive On
> MaxKeepAliveRequests 100
> KeepAliveTimeout 15
> StartServers 2
> ThreadsPerChild 25
> MinSpareThreads 25
> MaxSpareThreads 75
> MaxClients 150
> MaxRequestsPerChild 0
> Listen 80
> AliasMatch ^/manual(?:/(?:de|en|es|fr|ja|ko|ru))?(/.*)?$  
> "/usr/share/doc/apache-2.0.53/manual$1"
>     Options Indexes
>     AllowOverride None
>     Order allow,deny
>     Allow from all
>             SetHandler type-map
>     SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|ru)/  
> prefer-language=$1
>     RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|ru)){2,}(/.*)?$  
> /manual/$1$2
> SSLRandomSeed startup builtin
> SSLRandomSeed connect builtin
> Listen 443
> AddType application/x-x509-ca-cert .crt
> AddType application/x-pkcs7-crl    .crl
> SSLPassPhraseDialog builtin
> SSLSessionCache shm:/var/cache/apache2/ssl_scache(512000)
> SSLSessionCacheTimeout 300
> SSLMutex file:/var/cache/apache2/ssl_mutex
>     DocumentRoot "/var/www/localhost/htdocs"
>     ServerName localhost:443
>     ServerAdmin root at localhost
>     ErrorLog logs/ssl_error_log
>     TransferLog logs/ssl_access_log
>     SSLEngine on
>     SSLCipherSuite  
> ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
>     SSLCertificateFile conf/ssl/server.crt
>     SSLCertificateKeyFile conf/ssl/server.key
>             SSLOptions +StdEnvVars
>             SSLOptions +StdEnvVars
>     SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown     
>  downgrade-1.0 force-response-1.0
>     CustomLog logs/ssl_request_log           "%t %h %{SSL_PROTOCOL}x  
> %{SSL_CIPHER}x \"%r\" %b"
>     RewriteEngine On
>     RewriteOptions inherit
> Alias /webalizer "/var/www/webalizer"
>     Options None
>     AllowOverride None
>     Order allow,deny
>     Allow from all
> User apache
> Group apache
> ServerAdmin root at localhost
> UseCanonicalName Off
>     Options FollowSymLinks
>     AllowOverride None
> UserDir public_html
>     AllowOverride All
>     Options -MultiViews -Indexes SymLinksIfOwnerMatch IncludesNoExec
>             Order allow,deny
>         Allow from all
>             Order deny,allow
>         Deny from all
> DirectoryIndex index.html index.html.var
> AccessFileName .htaccess
>     Order allow,deny
>     Deny from all
> TypesConfig /etc/mime.types
> DefaultType text/plain
> HostnameLookups Off
> ErrorLog logs/error_log
> LogLevel warn
> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"  
> \"%{User-Agent}i\"" combined
> LogFormat "%h %l %u %t \"%r\" %>s %b" common
> LogFormat "%{Referer}i -> %U" referer
> LogFormat "%{User-agent}i" agent
> CustomLog logs/access_log common
> ServerTokens Prod
> ServerSignature On
> Alias /icons/ "/var/www/localhost/icons/"
>     Options Indexes -MultiViews
>     AllowOverride None
>     Order allow,deny
>     Allow from all
> ScriptAlias /cgi-bin/ /var/www/localhost/cgi-bin/
> ScriptAlias /protected-cgi-bin/ /var/www/localhost/protected-cgi-bin/
>     AllowOverride None
>     Options None
>     Order allow,deny
>     Allow from all
> IndexOptions FancyIndexing VersionSort
> AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
> AddIconByType (TXT,/icons/text.gif) text/*
> AddIconByType (IMG,/icons/image2.gif) image/*
> AddIconByType (SND,/icons/sound2.gif) audio/*
> AddIconByType (VID,/icons/movie.gif) video/*
> AddIcon /icons/binary.gif .bin .exe
> AddIcon /icons/binhex.gif .hqx
> AddIcon /icons/tar.gif .tar
> AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
> AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
> AddIcon /icons/a.gif .ps .ai .eps
> AddIcon /icons/layout.gif .html .shtml .htm .pdf
> AddIcon /icons/text.gif .txt
> AddIcon /icons/c.gif .c
> AddIcon /icons/p.gif .pl .py
> AddIcon /icons/f.gif .for
> AddIcon /icons/dvi.gif .dvi
> AddIcon /icons/uuencoded.gif .uu
> AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
> AddIcon /icons/tex.gif .tex
> AddIcon /icons/bomb.gif core
> AddIcon /icons/back.gif ..
> AddIcon /icons/hand.right.gif README
> AddIcon /icons/folder.gif ^^DIRECTORY^^
> AddIcon /icons/blank.gif ^^BLANKICON^^
> DefaultIcon /icons/unknown.gif
> ReadmeName README.html
> HeaderName HEADER.html
> IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t .svn
> AddLanguage ca .ca
> AddLanguage cs .cz .cs
> AddLanguage da .dk
> AddLanguage de .de
> AddLanguage el .el
> AddLanguage en .en
> AddLanguage eo .eo
> AddLanguage es .es
> AddLanguage et .et
> AddLanguage fr .fr
> AddLanguage he .he
> AddLanguage hr .hr
> AddLanguage it .it
> AddLanguage ja .ja
> AddLanguage ko .ko
> AddLanguage ltz .ltz
> AddLanguage nl .nl
> AddLanguage nn .nn
> AddLanguage no .no
> AddLanguage pl .po
> AddLanguage pt .pt
> AddLanguage pt-BR .pt-br
> AddLanguage ru .ru
> AddLanguage sv .sv
> AddLanguage zh-CN .zh-cn
> AddLanguage zh-TW .zh-tw
> LanguagePriority cs en ca da de el eo es et fr he hr it ja ko ltz nl  
> nn no pl pt pt-BR ru sv zh-CN zh-TW
> ForceLanguagePriority Prefer Fallback
> AddDefaultCharset ISO-8859-2
> AddCharset ISO-8859-1  .iso8859-1  .latin1
> AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
> AddCharset ISO-8859-3  .iso8859-3  .latin3
> AddCharset ISO-8859-4  .iso8859-4  .latin4
> AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru
> AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb
> AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk
> AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb
> AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk
> AddCharset ISO-2022-JP .iso2022-jp .jis
> AddCharset ISO-2022-KR .iso2022-kr .kis
> AddCharset ISO-2022-CN .iso2022-cn .cis
> AddCharset Big5        .Big5       .big5
> AddCharset WINDOWS-1251 .cp-1251   .win-1251
> AddCharset CP866       .cp866
> AddCharset KOI8-r      .koi8-r .koi8-ru
> AddCharset KOI8-ru     .koi8-uk .ua
> AddCharset ISO-10646-UCS-2 .ucs2
> AddCharset ISO-10646-UCS-4 .ucs4
> AddCharset UTF-8       .utf8
> AddCharset GB2312      .gb2312 .gb
> AddCharset utf-7       .utf7
> AddCharset utf-8       .utf8
> AddCharset big5        .big5 .b5
> AddCharset EUC-TW      .euc-tw
> AddCharset EUC-JP      .euc-jp
> AddCharset EUC-KR      .euc-kr
> AddCharset shift_jis   .sjis
> AddType application/x-compress .Z
> AddType application/x-gzip .gz .tgz
> AddHandler type-map var
> BrowserMatch "Mozilla/2" nokeepalive
> BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0  
> force-response-1.0
> BrowserMatch "RealPlayer 4\.0" force-response-1.0
> BrowserMatch "Java/1\.0" force-response-1.0
> BrowserMatch "JDK/1\.0" force-response-1.0
> BrowserMatch "Microsoft Data Access Internet Publishing Provider"  
> redirect-carefully
> BrowserMatch "^WebDrive" redirect-carefully
> BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
> BrowserMatch "^gnome-vfs" redirect-carefully
> NameVirtualHost *:80
>     DocumentRoot "/var/www/localhost/htdocs"
>             Options Indexes FollowSymLinks -MultiViews
>         AllowOverride None
>         Order allow,deny
>         Allow from all
>




More information about the Mod_python mailing list