Sorry for the subject ,it's difficult to describe.Here is the thing:
    I have developed a python extension using c++ ,mainly for querying
stardict format dictionary. It works fine outside the web framework.
But problem occurs when I import it and use it within the web
framework. I have been on this for quite a long time without success.
    I'm using apache 2.2.12 mod_wsgi 2.6 + web.py 0.33 on ubuntu 9.10,
here is the related code within the web framework:

class Query:
        def GET(self,w):
                if not w:
                        return 'query please'
                userdata=web.input(w=w)
                word=urllib.unquote_plus(web.utils.safestr(userdata.w))  #
                sd=stardict.Stardict('/usr/share/dicts')  #sd is a c++ object
wrapped in python
                res_tuple=sd.fuzzySearch('zombie')
                tmp_str=""
                for re in res_tuple:             #re also a c++ object wrapped 
in
python
                        tmp_str+=re.bookname+" "+re.exp
                return tmp_str   # unexpectedly,tmp_str is still blank

it returns nothing to my browser without any error in the error.log.
while the following code returns desired result when executed in
command line or a python file.

                sd=stardict.Stardict('/usr/share/dicts')
                res_tuple=sd.fuzzySearch('zombie')
                tmp_str=""
                for re in res_tuple:
                        tmp_str+=re.bookname+" "+re.exp
                print tmp_str

isn't it weird ?

the site is publicly unavailable now , more relating information is as
follows:

part of config file:
        <Directory /someplace/>
                        Options Indexes FollowSymLinks MultiViews
                        AllowOverride None
                        Order allow,deny
                        allow from all
           </Directory>

        WSGIScriptAlias / /someplace/app.wsgi

        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

part of httpd.conf:
         LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
         WSGIRestrictStdin Off   #neither works with or without
         WSGIRestrictStdout Off #neither works with or without

for the c extension python module , it depends on glib2.0 (no md5 or
expat ) and was wrapped to python by swig.

I totally have no idea why it happens. I hope it is not because of
mod_wsgi or web.py ,otherwise I have to do the nasty job of
transfering my application to other framework :(

--

You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=.


Reply via email to