Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard
Hi all, I have a mac mini running maocosx 10.5 leopard I want to deploy a django project on. My backend is MySQL, and I have it running as a 64- bit app. Of course, apache2 is also running as 64-bit. MySQLdb installs with the usual warnings after applying the various patches I found here and there. These patches consist of altering _mysql.c and site.cfg. Basically, my problem boils down to this: File "", line 1, in File "build/bdist.macosx-10.5-i386/egg/MySQLdb/__init__.py", line 19, in File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in __bootstrap__ ImportError: dynamic module does not define init function (init_mysql) Has anyone solved this? I been hunting around for 2 weeks now, and my deadline is looming grimly on the horizon :) Geert -- http://mail.python.org/mailman/listinfo/python-list
Re: Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard
On Mar 14, 11:49 am, "Robert Rawlins" <[EMAIL PROTECTED]> wrote: > Geert, > > I've not seen this issue myself, however, you might get a little more luck > asking over on theMySQLdbmailing list as this seems to be more an issue > with the db than your python code. It might be worth posting your question > there too as it'll heighten your chances of finding someone who > knowsMySQLdbinside out. > > http://mail.python.org/mailman/listinfo/db-sig > > Cheers, > > Robert > > -Original Message- > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] > On Behalf Of geert > Sent: 14 March 2008 10:36 > To: [EMAIL PROTECTED] > Subject: Huge problem gettngMySQLdbto work on my mac mini running Macosx > 10.5 Leopard > > Hi all, > > I have a mac mini running maocosx 10.5 leopard I want to deploy a > django project on. My backend is MySQL, and I have it running as a 64- > bit app. Of course, apache2 is also running as 64-bit. > > MySQLdbinstalls with the usual warnings after applying the various > patches I found here and there. These patches consist of altering > _mysql.c and site.cfg. > > Basically, my problem boils down to this: > > File "", line 1, in > File "build/bdist.macosx-10.5-i386/egg/MySQLdb/__init__.py", line > 19, in > File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in > > File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in > __bootstrap__ > ImportError: dynamic module does not define init function (init_mysql) > > Has anyone solved this? I been hunting around for 2 weeks now, and my > deadline is looming grimly on the horizon :) > > Geert > > --http://mail.python.org/mailman/listinfo/python-list Thanks, Robert. I'm on the MySQLdb list, and am working on a solution. And I've subscribed to the list you gave. Geert -- http://mail.python.org/mailman/listinfo/python-list
Re: Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard
On Mar 14, 1:15 pm, [EMAIL PROTECTED] wrote: > look > athttp://groups.google.be/group/comp.lang.python/browse_thread/thread/d... > > There is a macpython list that you can consult > athttp://www.nabble.com/Python---pythonmac-sig-f2970.html Just wanted to let you know that I've solved my problem. The solution is to compile mysql using MACOSX_DEPLOYMENT_TARGET=10.5 \ CFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ LDFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ CXXFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ ./configure --disable-dependency-tracking --enable-thread-safe-client --prefix=/usr/local/mysql You then go this way to get it running on your machine: http://hivelogic.com/articles/installing-mysql-on-mac-os-x/ Then reinstall MySQLdb. Magic! Geert -- http://mail.python.org/mailman/listinfo/python-list
Re: Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard
On Mar 18, 6:56 pm, geert <[EMAIL PROTECTED]> wrote: > On Mar 14, 1:15 pm, [EMAIL PROTECTED] wrote: > > > look > > athttp://groups.google.be/group/comp.lang.python/browse_thread/thread/d... > > > There is a macpython list that you can consult > > athttp://www.nabble.com/Python---pythonmac-sig-f2970.html > > Just wanted to let you know that I've solved my problem. The solution > is to compile mysql using > > MACOSX_DEPLOYMENT_TARGET=10.5 \ > CFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ > LDFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ > CXXFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ > ./configure --disable-dependency-tracking --enable-thread-safe-client > --prefix=/usr/local/mysql > > You then go this way to get it running on your machine: > > http://hivelogic.com/articles/installing-mysql-on-mac-os-x/ > > Then reinstall MySQLdb. Magic! > > Geert Seems that I've yelled success to quickly. Everything's ok as long as I just run the django dev server, but moving to apache through mod_wsgi brings a well-known but less than comforting complaint: [Tue Mar 18 23:34:25 2008] [error] [client ::1] mod_wsgi (pid=2352): Exception occurred processing WSGI script '/Users/geert/Sites/LithoNET/ LN/LNApache.wsgi'., referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] Traceback (most recent call last):, referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ Python/2.5/site-packages/django/core/handlers/wsgi.py", line 205, in __call__, referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] response = self.get_response(request), referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ Python/2.5/site-packages/django/core/handlers/base.py", line 64, in get_response, referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] response = middleware_method(request), referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ Python/2.5/site-packages/django/contrib/sessions/middleware.py", line 13, in process_request, referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] engine = __import__(settings.SESSION_ENGINE, {}, {}, ['']), referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ Python/2.5/site-packages/django/contrib/sessions/backends/db.py", line 2, in , referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] from django.contrib.sessions.models import Session, referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ Python/2.5/site-packages/django/contrib/sessions/models.py", line 5, in , referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] from django.db import models, referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ Python/2.5/site-packages/django/db/__init__.py", line 17, in , referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] backend = __import__('%s%s.base' % (_import_path, settings.DATABASE_ENGINE), {}, {}, ['']), referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ Python/2.5/site-packages/django/db/backends/mysql/base.py", line 12, in , referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e), referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/WebServer/.python-eggs/ MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so, 2): no suitable image found. Did find:, referer: http://localhost/images/ [Tue Mar 18 23:34:25 2008] [error] [client ::1] \t/Library/ WebServer/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg- tmp/_mysql.so: no matching architecture in universal wrapper, referer: http://localhost/images/ mm Geert -- http://mail.python.org/mailman/listinfo/python-list
Re: Huge problem gettng MySQLdb to work on my mac mini running Macosx 10.5 Leopard
On Mar 19, 2:26 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Mar 19, 9:47 am, geert <[EMAIL PROTECTED]> wrote: > > > > > On Mar 18, 6:56 pm, geert <[EMAIL PROTECTED]> wrote: > > > > On Mar 14, 1:15 pm, [EMAIL PROTECTED] wrote: > > > > > look > > > > athttp://groups.google.be/group/comp.lang.python/browse_thread/thread/d... > > > > > There is a macpython list that you can consult > > > > athttp://www.nabble.com/Python---pythonmac-sig-f2970.html > > > > Just wanted to let you know that I've solved my problem. The solution > > > is to compile mysql using > > > > MACOSX_DEPLOYMENT_TARGET=10.5 \ > > > CFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ > > > LDFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ > > > CXXFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ > > > ./configure --disable-dependency-tracking --enable-thread-safe-client > > > --prefix=/usr/local/mysql > > > > You then go this way to get it running on your machine: > > > >http://hivelogic.com/articles/installing-mysql-on-mac-os-x/ > > > > Then reinstall MySQLdb. Magic! > > > > Geert > > > Seems that I've yelled success to quickly. Everything's ok as long as > > I just run the django dev server, but moving to apache > > throughmod_wsgibrings a well-known but less than comforting complaint: > > > [Tue Mar 18 23:34:25 2008] [error] [client ::1]mod_wsgi(pid=2352): > > Exception occurred processing WSGI script '/Users/geert/Sites/LithoNET/ > > LN/LNApache.wsgi'., referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] Traceback (most recent > > call last):, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/core/handlers/wsgi.py", line 205, in > > __call__, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] response = > > self.get_response(request), referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/core/handlers/base.py", line 64, in > > get_response, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] response = > > middleware_method(request), referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/contrib/sessions/middleware.py", line > > 13, in process_request, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] engine = > > __import__(settings.SESSION_ENGINE, {}, {}, ['']), > > referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/contrib/sessions/backends/db.py", line > > 2, in , referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] from > > django.contrib.sessions.models import Session, > > referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/contrib/sessions/models.py", line 5, > > in , referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] from django.db > > import models, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/db/__init__.py", line 17, in , > > referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] backend = > > __import__('%s%s.base' % (_import_path, settings.DATABASE_ENGINE), {}, > > {}, ['']), referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/db/backends/mysql/base.py", line 12, > > in , referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] raise > > ImproperlyConfigured("Error loading MySQLdb module: %s" % e), > > referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] ImproperlyConfigured: > > Error loading MySQLdb module: dlopen(/Library/WebServer/.python-eggs/ > > MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so, 2): no > > suitable image found. Did find:, referer:htt
Profiling with hotshot and wall clock time
Hi! I'm trying to profile an application that I believe is blocking on I/O for a significant amount of time. In trying to dig down where this happens, I profiled the application with hotshot. The results are not really usable however as it seems to display the amount of CPU time which for my application is much lower than the total run time. Is possible to use hotshot with wall clock time, i.e. is it possible to have the code fragment below show one second as opposed to zero? The old profiler seems to have functionality choosing a timer function but it crashed on my code. import os import time import hotshot import hotshot.stats import tempfile def profile(call, *args): """Profile function `call', invoked with `args'.""" fd, fprof = tempfile.mkstemp() os.close(fd) profiler = hotshot.Profile(fprof) profiler.runcall(call, *args) profiler.close() stats = hotshot.stats.load(fprof) stats.strip_dirs().sort_stats('time').print_stats() os.remove(fprof) profile(time.sleep, 1) Regards, Geert Jansen -- http://mail.python.org/mailman/listinfo/python-list
Strange behaviour with eval() and globals() copy
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I'm experiencing a weird problem with eval(), providing it a copy of the globals() dictionary. The following code works: s = """ def func(level): if level < 2: func(level+1) func(0) """ c = compile(s, '', 'exec') g = globals() #g = g.copy() l = locals() eval(c, g, l) But if I comment in the line "g = g.copy()" and run the same snippet again, I get the following error: Traceback (most recent call last): File "test.py", line 12, in ? eval(c, g, l) File "", line 5, in ? File "", line 4, in func NameError: global name 'func' is not defined Any ideas? Basically I'm trying to evaluate code with a specific global and local namespace. However, I cannot get this to work unless I use the exact global namespace as returned by globals(), any other mapping makes this code fail. Python version is 2.4.2 on Linux. Regards, Geert -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQEVAwUBQ7RFwprPkVOV4lDgAQKK+Af/eEHbkHiUtH79trDsgvyTwY6xTayk+nB2 nHZL6iD0aRlDfLtccsP2OTLafJdNwb764vK6hqQFuvN2ol4v5SVwEnsJ4EvtwKyH iJcByEXZSrPjBsCejKPsoLCCCJ3q8UdkO4zsYsd+xSqCuJAYzfEnSf75yu6PY3Hh N7uzPT626BdUq5wHaWlbAKqtmCfN5kOodgkTE3s7/h9JlP4EeKyF4s5sCFQdJ0jw CWXr28gOMcWBvlVLOVSbeDq5/n5YWfaJKpbGYXolv5H9Cyxa4rZ1AMy628u1DnPa he7sX2T0pTNOaeVJGWanSR99jbq2VxDaiocQdpjUnEHqaUSY8YhFTw== =lbmj -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Path question
Hi, I have the following path construction: ./src/__init__.py /main.py /modules/__init__.py /application.py /ui/__init__.py /mainwindow/__init__.py /mainwindow.py Now I want to call the method 'MainWindow' in the module 'mainwindow', from the module 'application'. I'm having the following import statement in 'applications.py': from .. ui.mainwindow.mainwindow import MainWindow That doesn't work. I've also tried many other combinations like from ..ui.mainwindow... but none of them work. I always get the following error: "Attempted relative import beyond toplevel package" How can I import the method 'MainWindow' from 'mainwindow' into 'application', using the explicit relative import rules? Or is there a better way to do this? -- Best rgds, Geert *Use EcoCho <http://www.ecocho.com>: environmentally friendly search the internet!* -- http://mail.python.org/mailman/listinfo/python-list
Re: Path question
Diez B. Roggisch wrote: Geert Vancompernolle schrieb: Hi, I have the following path construction: ./src/__init__.py /main.py /modules/__init__.py /application.py /ui/__init__.py /mainwindow/__init__.py /mainwindow.py Now I want to call the method 'MainWindow' in the module 'mainwindow', from the module 'application'. I'm having the following import statement in 'applications.py': from .. ui.mainwindow.mainwindow import MainWindow That doesn't work. I've also tried many other combinations like from ..ui.mainwindow... but none of them work. I always get the following error: "Attempted relative import beyond toplevel package" How can I import the method 'MainWindow' from 'mainwindow' into 'application', using the explicit relative import rules? Or is there a better way to do this? Rename "src" to "myapp", and start main.py from above that. That should work. Diez -- http://mail.python.org/mailman/listinfo/python-list That trick did it, thanks! But I have one more unclarity about relative import rules. Here <http://docs.python.org/tutorial/modules.html?highlight=modules>, one can find an explanation about modules in the official Python 2.6.1 documentation. In that article, there's an example of importing relative packages (in the section "Packages"). I see the following examples: from . import echo from .. import formats from ..filters import equalizer Applying that mechanism on my application, I'm using the following construction (see my initial email): "from .. ui.mainwindow.mainwindow import MainWindow" But using "from ..ui.mainwindow.mainwindow import MainWindow" seems to be giving exactly the same result (mind the lacking space between ".." and "ui"). So, what's the difference (if there is one) between "from .. ui.mainwin..." and "from ..ui.mainwin..." (again, mind the difference in space)? I guess there's a difference, otherwise it would not be given as an example in the Python documentation. But then, why is the application (at first sight) behaving the same and also working fine? -- Best rgds, Geert *Use EcoCho <http://www.ecocho.com>: environmentally friendly search the internet!* -- http://mail.python.org/mailman/listinfo/python-list
Python DLL's for C++?
Hi, Is it possible to write DLL's in Python for applications that only provide C++ interfaces? Example: NotePad++ is extendible by writing C++ DLL's which can call the NotePad++ interfaces. I wonder if those DLL's also can be written in Python, which in the end calls the C++ interfaces of NotePad++... -- Best rgds, Geert *Use EcoCho <http://www.ecocho.com>: environmentally friendly search the internet!* -- http://mail.python.org/mailman/listinfo/python-list
How to run Python in Windows w/o popping a DOS box?
I know it's been a long while since this thread has been handled, but maybe this is a "final" solution to your problem (if not yet resolved): http://www.py2exe.org/index.cgi/SingleFileExecutable Especially the last setup.py file results in only one exe which contains *all* the necessary stuff (only tested it on small examples, though) Maybe you can give this a try... Best rgds, --Geert * * -- http://mail.python.org/mailman/listinfo/python-list
PyImport_Import fails on linux
Hi all, I'm currently migrating an application from a windows platform to linux. I have somewhere a module which uses embedded python: (a python script where I want to call some functions...) // Initialize the python library Py_Initialize(); PyObject *pName = PyString_FromString("RASBatch"); // Load the Python module m_pModule = PyImport_Import(pName); if (m_pModule != NULL) { ... } else { ... } Loading the module always returns NULL... When starting python on the command line, I can import the python script and execute the function which i want to call from my C module. I've tried also copying the script on several locations... Anyone any idea? (Using python 2.2 on suse8.2) Thanks in advance! Geert -- http://mail.python.org/mailman/listinfo/python-list
Crash in PyImport_Import()
Hi, The following script works fine when I call it from the python interpreter but not when I call it from a c application (embedded python) It crashes in the PyImport_Import() import ldap import distutils.sysconfig def TestInit(): l = ldap.open("192.168.1.2") l.simple_bind_s("","") l.search_s("c=BE", ldap.SCOPE_SUBTREE, "objectclass=*") s = distutils.sysconfig.get_config_var('LINKFORSHARED') -> Python (2.5) and python-ldap (2.2.1) are recompiled for my environment (hardened linux.) Here is part of my makefile: VERSION = Python-2.5 VERSION_LDAP = python-ldap-2.2.1 compile: .python .python-ldap .python:makefile.python .glibc $(VERSION).Setup.local $(EXTRACT_PACKAGE) && \ $(CP) ../$(VERSION).Setup.local Modules/Setup.local && \ ./configure --prefix=/usr --enable-shared=no && \ make && \ make install cp $(VERSION)/libpython2.5.a /usr/lib/libpython.a (cd /usr/include; $(LN) -sf python2.5 python ) touch .python .python-ldap: makefile.python .python .sasl .glibc .openldap python-ldap.setup.cfg (rm -rf $(VERSION_LDAP) || /bin/true) && \ tar xjf $(ARCHIVE_PACKAGES)/$(VERSION_LDAP).tar.bz2 && \ cd $(VERSION_LDAP) && \ $(CP) ../python-ldap.setup.cfg setup.cfg && \ python setup.py build && \ python setup.py install rm -rf $(VERSION_LDAP) touch .python-ldap And my setup.cfg # Example for setup.cfg # You have to edit this file to reflect your system configuation # $Id: setup.cfg.suse-linux,v 1.1 2003/08/20 10:04:34 stroeder Exp $ [_ldap] # Section for compiling the C extension module # for wrapping OpenLDAP 2 libs library_dirs = /usr/lib/ /usr/lib/sasl2/ include_dirs = /usr/include/sasl/ /usr/include/sasl2/ extra_compile_args = extra_objects = # Example for full-featured SuSE build: # Support for StartTLS/LDAPS, SASL bind and reentrant libldap_r. # This needs recent OpenLDAP 2.0.26+ or 2.1.3+ built with #./configure --with-cyrus-sasl --with-tls libs = python ldap_r lber sasl2 ssl crypto resolv dl db m util pthread [install] # Installation options compile = 1 optimize = 1 Everything is done in a chroot-ed environment...when building python-ldap, it uses the newly installed python includes The test application is linked against the static version libpython.a int CPyLDAP::Init() { m_iPython = 1; printf ("Before Py_Initialize...\n"); Py_Initialize(); printf ("After Py_Initialize...\n"); PyObject *pName = PyString_FromString("PyTest"); if ( pName != NULL ) { // Load the Python module printf ("Before Import...\n"); m_pModule = PyImport_Import(pName); printf ("After Import...\n"); if (m_pModule != NULL) { m_iPython = 0; m_pDictionary = PyModule_GetDict(m_pModule); } } return (m_iPython); } Hope someone can give me a hint? thanks, Geert -- http://mail.python.org/mailman/listinfo/python-list
FW: Crash in PyImport_Import()
Hi, And everything works fine if I link with the shared version of python. The ldap extension works fine in the interpreter, as well as with embedded python. Does anyone knows why it seems to be needed that extension modules have to be linked against the shared version of python? Regards, Geert _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Geert Van Muylem Sent: maandag 18 december 2006 22:51 To: python-list@python.org Subject: Crash in PyImport_Import() Hi, The following script works fine when I call it from the python interpreter but not when I call it from a c application (embedded python) It crashes in the PyImport_Import() import ldap import distutils.sysconfig def TestInit(): l = ldap.open("192.168.1.2") l.simple_bind_s("","") l.search_s("c=BE", ldap.SCOPE_SUBTREE, "objectclass=*") s = distutils.sysconfig.get_config_var('LINKFORSHARED') -> Python (2.5) and python-ldap (2.2.1) are recompiled for my environment (hardened linux.) Here is part of my makefile: VERSION = Python-2.5 VERSION_LDAP = python-ldap-2.2.1 compile: .python .python-ldap .python:makefile.python .glibc $(VERSION).Setup.local $(EXTRACT_PACKAGE) && \ $(CP) ../$(VERSION).Setup.local Modules/Setup.local && \ ./configure --prefix=/usr --enable-shared=no && \ make && \ make install cp $(VERSION)/libpython2.5.a /usr/lib/libpython.a (cd /usr/include; $(LN) -sf python2.5 python ) touch .python .python-ldap: makefile.python .python .sasl .glibc .openldap python-ldap.setup.cfg (rm -rf $(VERSION_LDAP) || /bin/true) && \ tar xjf $(ARCHIVE_PACKAGES)/$(VERSION_LDAP).tar.bz2 && \ cd $(VERSION_LDAP) && \ $(CP) ../python-ldap.setup.cfg setup.cfg && \ python setup.py build && \ python setup.py install rm -rf $(VERSION_LDAP) touch .python-ldap And my setup.cfg # Example for setup.cfg # You have to edit this file to reflect your system configuation # $Id: setup.cfg.suse-linux,v 1.1 2003/08/20 10:04:34 stroeder Exp $ [_ldap] # Section for compiling the C extension module # for wrapping OpenLDAP 2 libs library_dirs = /usr/lib/ /usr/lib/sasl2/ include_dirs = /usr/include/sasl/ /usr/include/sasl2/ extra_compile_args = extra_objects = # Example for full-featured SuSE build: # Support for StartTLS/LDAPS, SASL bind and reentrant libldap_r. # This needs recent OpenLDAP 2.0.26+ or 2.1.3+ built with #./configure --with-cyrus-sasl --with-tls libs = python ldap_r lber sasl2 ssl crypto resolv dl db m util pthread [install] # Installation options compile = 1 optimize = 1 Everything is done in a chroot-ed environment...when building python-ldap, it uses the newly installed python includes The test application is linked against the static version libpython.a int CPyLDAP::Init() { m_iPython = 1; printf ("Before Py_Initialize...\n"); Py_Initialize(); printf ("After Py_Initialize...\n"); PyObject *pName = PyString_FromString("PyTest"); if ( pName != NULL ) { // Load the Python module printf ("Before Import...\n"); m_pModule = PyImport_Import(pName); printf ("After Import...\n"); if (m_pModule != NULL) { m_iPython = 0; m_pDictionary = PyModule_GetDict(m_pModule); } } return (m_iPython); } Hope someone can give me a hint? thanks, Geert -- http://mail.python.org/mailman/listinfo/python-list-- http://mail.python.org/mailman/listinfo/python-list