This forum is no longer active. Please post your questions to our new community site

missing _socket.so in python 2.5.1

Subscribe to missing _socket.so in python 2.5.1 6 post(s), 2 voice(s)

 
Avatar goriogaul 3 post(s)

Just installed bitnami-djangostack-1.0.2-0-osx-x86-installer.app.
Tried interfacing to mysql using sockets and I get an error
stating that socket module was missing. I looked at the python directory
and there was no _socket.so unlike the default python 2.5.1 lib-dynload.

What did I miss?

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

What is the exact error? This post could help you. The mysql socket is created at <installation_directoy>/mysql/tmp/mysql.sock.

Cheers.

 
Avatar goriogaul 3 post(s)

hello

I tried recommendation from the post(http://passingcuriosity.com/2009/specifying-a-unix-socket-using-mysql-with-django/).
I added
DATABASE_OPTIONS = { ‘unix_socket’ : ’/Applications/djangostack102/mysql/tmp/mysql.sock’,
}
changed

DATABASE_HOST = 127.0.0.1

but I received the same error as before, same as below.

The error that I got from the /Applications/djangostack102/apache2/logs/error_log is as follows:

mod_wsgi (pid=8573): Target WSGI script ’/Users/bongo/Projects/untote/workspace/trunk/src/untote/apache/wsgi_handler.py’ cannot be loaded as Python module.
mod_wsgi (pid=8573): Exception occurred processing WSGI script ’/Users/bongo/Projects/untote/workspace/trunk/src/untote/apache/wsgi_handler.py’.
Traceback (most recent call last): File ”/Users/eumircamara/Projects/untote/workspace/trunk/src/untote/apache/wsgi_handler.py”, line 17, in <module> import django.core.handlers.wsgi File ”/Applications/djangostack102/apps/django/lib/python2.5/site-packages/django/core/handlers/wsgi.py”, line 8, in <module> from django import http File ”/Applications/djangostack102/apps/django/lib/python2.5/site-packages/django/http/init.py”, line 5, in <module> from urllib import urlencode File ”/Applications/djangostack102/python/lib/python2.5/urllib.py”, line 26, in <module> import socket File ”/Applications/djangostack102/python/lib/python2.5/socket.py”, line 45, in <module> import _socket
ImportError: No module named _socket

In my settings.py I have the following database configuration options:

DATABASE_ENGINE = ‘mysql’ # ‘postgresql_psycopg2’, ‘postgresql’, ‘mysql’, ‘sqlite3’ or ‘oracle’.
DATABASE_NAME = ‘bongo’ # Or path to database file if using sqlite3.
DATABASE_USER = ‘bongo’ # Not used with sqlite3.
DATABASE_PASSWORD = ‘bongo’ # Not used with sqlite3.
DATABASE_HOST = ’/Applications/djangostack102/mysql/tmp/mysql.sock’ # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ‘3308’ # Set to empty string for default. Not used with sqlite3.

Just to repeat, I tried looking for the socket module in the python django stack and it wasn’t there.

As additional info, running /Applications/djangostack102/python/bin/python manage.py syncdb does work without a hitch.

thanks.

 
Avatar goriogaul 3 post(s)

Hello,

Found a fix.
I copied the _socket.so file from apple’s default python 2.5.1 installation to bitnami djangostack’s python lib
and the problem was fixed.
(from: /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/_socket.so to: /Applications/djangostack102/python/lib/python2.5/lib-dynload/_socket.so)

Perhaps _socket.so should be included in the bitnami django stack installer.

Thanks.

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

You are right, the socket module should be included in the Django Stack by default. We will add this issue in our TODO list. Thanks for reporting it.