I'm hoping to run my webapp in Apache, but it seems like I can't
import ctypes in my code.

I wrote this trivial wsgi app to short the problem:

def application(environ, start_response):

    import ctypes # this crashes

    status = '200 OK'
    output = 'Hello World!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]

    start_response(status, response_headers)

    return [output]

Then I set up this virtual host:

<VirtualHost *:80>

    ServerName pitz.sprout.tplus1.com

    ServerAdmin webmas...@localhost

    DocumentRoot /home/matt/checkouts/pitz/pitz/static

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel info

    CustomLog /var/log/apache2/pitz-access.log combined
    ErrorLog /var/log/apache2/pitz-error.log
    ServerSignature On

    <Directory /home/matt/checkoutz/pitz/apache-nonsense>
    Order allow,deny
    Allow from all
    </Directory>

    WSGIProcessGroup pitz
    WSGIApplicationGroup %{GLOBAL}

    WSGIScriptAlias / /home/matt/checkouts/pitz/apache-nonsense/
myapp.wsgi

    RewriteEngine on
    RewriteRule ^/static/(.*) /home/matt/checkouts/pitz/pitz/static/$1
[last]
    RewriteRule ^/favicon.ico /home/matt/checkouts/pitz/pitz/static/
favicon.ico [last]

</VirtualHost>

And I have this stuff too:

WSGIPythonHome /home/matt/.virtualenvs/pitz
WSGIPythonPath /home/matt/.virtualenvs/pitz/lib/python2.6/site-
packages
WSGIDaemonProcess pitz processes=1 threads=10 display-name=%{GROUP}

When I restart apache, and then hit http://pitz.sprout.tplus1.com/, I
get a 500 back, and this error is in my errors log file:

[Sat Dec 04 15:58:01 2010] [error] [client 127.0.1.1] mod_wsgi
(pid=9678): Exception occurred processing WSGI script '/home/matt/
checkouts/pitz/apache-nonsense
[Sat Dec 04 15:58:01 2010] [error] [client 127.0.1.1] Traceback (most
recent call last):
[Sat Dec 04 15:58:01 2010] [error] [client 127.0.1.1]   File "/home/
matt/checkouts/pitz/apache-nonsense/myapp.wsgi", line 5, in
application
[Sat Dec 04 15:58:01 2010] [error] [client 127.0.1.1]     import
ctypes
[Sat Dec 04 15:58:01 2010] [error] [client 127.0.1.1]   File "/usr/
local/lib/python2.6/ctypes/__init__.py", line 10, in <module>
[Sat Dec 04 15:58:01 2010] [error] [client 127.0.1.1]     from _ctypes
import Union, Structure, Array
[Sat Dec 04 15:58:01 2010] [error] [client 127.0.1.1] ImportError: /
usr/local/lib/python2.6/lib-dynload/_ctypes.so: undefined symbol:
PyUnicodeUCS2_FromEncoded
(END)

I'm running ubuntu 10.0.4 LTS, I installed the stock apache2:

$ apache2 -version
Server version: Apache/2.2.14 (Ubuntu)
Server built:   Nov 18 2010 21:17:19

The mod_wsgi version I'm running is this 2.8 (it's the one I got from
ubuntu).

I just noticed you're up to version 3.3 -- maybe this problem has
already been fixed, or maybe there's something wrong with my
configuration.  Anyhow, I could really use a little help.

Matt

-- 
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