I checked path and it looks fine

there is a libzmq.dll at PATH folder.

The thing that is annoying is, it works find without wsgi.

some code like.

import zmq

context = zmq.Context()

# Socket to talk to server
print "Connecting to hello world server"
socket = context.socket(zmq.REQ)
socket.connect ("tcp://localhost:5555")

works just fine


On Jan 6, 11:59 am, Graham Dumpleton <[email protected]>
wrote:
> Try adding before the import lines like:
>
>   import sys
>   import os
>
>   print >> sys.stderr, 'PATH=%s' % os.environ['PATH']
>
> In other words, work out what PATH is set to for the process and then
> check that all required DLLs that may be needed in turn by the
> extension module are located on that PATH.
>
> Maybe the issue is that it can't find a required DLL.
>
> Graham
>
> On 6 January 2012 13:28, Psi <[email protected]> wrote:
>
>
>
>
>
>
>
> > I am using mod_wsgi for python 2.7 and it completely works well
> > without zmq things.
> > And zmq works well when it used stand alone.
>
> > I don't know why mod_wsgi cannot import zmq.
>
> > Plus, it does not work even if I remove add site-package things.
>
> > On Jan 6, 11:20 am, Graham Dumpleton <[email protected]>
> > wrote:
> >> On 6 January 2012 12:39, Psi <[email protected]> wrote:
>
> >> > i am trying to make web site which retrieves query from the user, and
> >> > process it by C++ based searching program. In order to achieve this, I
> >> > used python script which gets the query and send the query to C++
> >> > program by zeromq. However it seems like mod_wsgi cannot import zeromq
> >> > even though it perfectly worked well without mod_wsgi or without
> >> > zeromq
>
> >> > I got an error message like this;
>
> >> > File "D:/wsgi_app/wsgi_app.py", line 2, in <module>, 
> >> > referer:http://localhost/
> >> >         import zmq, referer:http://localhost/
>
> >> > File "D:\\util\\Python27\\lib\\site-packages\\zmq\\__init__.py", line
> >> > 35, in <module>, referer:http://localhost/
> >> >         from zmq.utils import initthreads # initialize threads,
> >> > referer:http://localhost/
>
> >> > ImportError: DLL load failed: \xc1\xf6\xc1\xa4\xb5\xc8
> >> > \xb8\xf0\xb5\xe2\xc0\xbb \xc3\xa3\xc0\xbb \xbc\xf6 \xbe\xf8\xbd
> >> > \xc0\xb4\xcf\xb4\xd9., referer:http://localhost/
>
> >> > The code below shows how I implemented it. Please help me
>
> >> > import site
> >> > site.addsitedir("D:\\util\\Python27\\Lib\\site-packages")
>
> >> Why are you needing to explicitly add site-packages into sys.path?
>
> >> This immediately suggests you are doing something wrong as it should
> >> not be necessary.
>
> >> Is mod_wsgi.so you are using for Python 2.7? Did you install Python
> >> for all users or just the user you installed it as? You are supposed
> >> to install it for all users.
>
> >> Presuming that zmq module has a C extension component, is that module
> >> compiled as 32 bit for the Python version mod_wsgi is compiled for?
>
> >> Graham
>
> >> > from cgi import parse_qs, escape
> >> > import zmq # HERE IS THE ERROR
> >> > def application( # It accepts two arguments:
> >> >      # environ points to a dictionary containing CGI like environment
> >> > variables
> >> >      # which is filled by the server for each received request from
> >> > the client
> >> >      environ,
> >> >      # start_response is a callback function supplied by the server
> >> >      # which will be used to send the HTTP status and headers to the
> >> > server
> >> >      start_response):
>
> >> >    # get a query from the webpage :)
> >> >   data = parse_qs(environ['QUERY_STRING'])
>
> >> >   query = data.get('query', [''])[0]
> >> >   query = escape(query) #prevent script injection
>
> >> >   context = zmq.Context()
> >> >   socket = context.socket(zmq.REQ)
> >> >   socket.connect ("tcp://localhost:5555") #connect to C++ search
> >> > server database
> >> >   socket.send (query)
>
> >> >   # build the response body possibly using the environ dictionary
> >> >   response_body = 'The request method was %s' %
> >> > environ['REQUEST_METHOD']
>
> >> >   # HTTP response code and message
> >> >   status = '200 OK'
>
> >> >   # These are HTTP headers expected by the client.
> >> >   # They must be wrapped as a list of tupled pairs:
> >> >   # [(Header name, Header value)].
> >> >   response_headers = [('Content-Type', 'text/plain'),
> >> >                       ('Content-Length', str(len(response_body)))]
>
> >> >   # Send them to the server using the supplied function
> >> >   start_response(status, response_headers)
>
> >> >   # Return the response body.
> >> >   # Notice it is wrapped in a list although it could be any iterable.
> >> >   return [response_body]
>
> >> > --
> >> > 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 
> >> > athttp://groups.google.com/group/modwsgi?hl=en.
>
> > --
> > 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 
> > athttp://groups.google.com/group/modwsgi?hl=en.

-- 
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=en.

Reply via email to