[mod_python] query regarding pyodbc

Graham Dumpleton graham.dumpleton at gmail.com
Fri Feb 6 08:47:05 EST 2009


Recompile mod_python so it uses the correct installation of Python.
You cannot change it dynamically at run time. Use the '--with-python'
option to mod_python configure command. The argument to it should be
the path to 'python' executable for installation you want to use.

Graham

2009/2/6 rahul <rahul.warhekar at edisphere.com>:
> Hello
>
>
>
> Just Now, I got something as my .psp pages are pointing to my old version of
> python2.3 which is also installed in my system.
>
>
>
> For this I do export PYTHON=/usr/local/lib/python2.5
>
> But it was not useful I still got problem
>
> The error is
>
>
>
> MOD_PYTHON ERROR
>
>
>
> URI:            '/edi/redirect.psp'
>
> Location:       None
>
> Directory:      '/var/www/'
>
> Filename:       '/var/www/edi/redirect.psp'
>
> PathInfo:       ''
>
>
>
> Phase:          'PythonHandler'
>
> Handler:        'mod_python.psp'
>
>
>
> Traceback (most recent call last):
>
>
>
>   File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line 1537,
> in HandlerDispatch
>
>     default=default_handler, arg=req, silent=hlist.silent)
>
>
>
>   File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line 1229,
> in _process_target
>
>     result = _execute_target(config, req, object, arg)
>
>
>
>   File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line 1128,
> in _execute_target
>
>     result = object(arg)
>
>
>
>   File "/usr/lib/python2.3/site-packages/mod_python/psp.py", line 337, in
> handler
>
>     p.run()
>
>
>
>   File "/usr/lib/python2.3/site-packages/mod_python/psp.py", line 243, in
> run
>
>     exec code in global_scope
>
>
>
>   File "/var/www/redirect.psp", line 18, in ?
>
>     import pyodbc
>
>
>
> ImportError: dynamic module does not define init function (initpyodbc)
>
>
>
>
>
>
>
> Is there any way to point to the newer version of python2.5
>
>
>
>
>
>
>
> -----Original Message-----
> From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com]
> Sent: Friday, February 06, 2009 1:01 PM
> To: rahul
> Cc: mod_python at modpython.org
> Subject: Re: [mod_python] query regarding pyodbc
>
>
>
> 2009/2/6 rahul <rahul.warhekar at edisphere.com>:
>
>> Hello sir,
>
>>
>
>> Now import pyodbc is working from python console but when I import it from
>
>> .psp pages it is giving error as
>
>> ImportError : dynamic module does not define init function (initpyodbc)
>
>>
>
>> I check  using nm pyodbc.so command it is giving initpyodbc function in
>> the
>
>> list
>
>>
>
>> Now what may be the problem?
>
>
>
> It is likely picking up wrong version still. Where is pyodbc package
>
> installed? Did you ensure that old broken versions were removed from
>
> the system?
>
>
>
> Graham
>
>
>
>>
>
>> -----Original Message-----
>
>> From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com]
>
>> Sent: Friday, January 16, 2009 4:24 PM
>
>> To: rahul
>
>> Cc: mod_python at modpython.org
>
>> Subject: Re: [mod_python] query regarding pyodbc
>
>>
>
>> 2009/1/16 rahul <rahul.warhekar at edisphere.com>:
>
>>> I have run it from python console and it is giving same error.
>
>>
>
>> Then it is not a mod_python issue and you perhaps should ask on:
>
>>
>
>>  http://groups.google.com/group/comp.lang.python/topics?lnk
>
>>
>
>>> Now, I used nm command for pyodbc.so file and got the following output.
>
>>>
>
>>> [root at dbserver site-packages]# nm pyodbc.so
>
>>> 00001600 A __bss_start
>
>>> 000003ec t call_gmon_start
>
>>> 00001600 b completed.1
>
>>> 000014fc d __CTOR_END__
>
>>> 000014f8 d __CTOR_LIST__
>
>>>         w __cxa_finalize@@GLIBC_2.1.3
>
>>> 000004a8 t __do_global_ctors_aux
>
>>> 00000410 t __do_global_dtors_aux
>
>>> 000015f8 d __dso_handle
>
>>> 00001504 d __DTOR_END__
>
>>> 00001500 d __DTOR_LIST__
>
>>> 0000150c A _DYNAMIC
>
>>> 00001600 A _edata
>
>>> 00001604 A _end
>
>>> 000004d8 T _fini
>
>>> 0000046c t frame_dummy
>
>>> 000004f4 r __FRAME_END__
>
>>> 000015e8 A _GLOBAL_OFFSET_TABLE_
>
>>>         w __gmon_start__
>
>>> 000003b4 T _init
>
>>> 00001508 d __JCR_END__
>
>>> 00001508 d __JCR_LIST__
>
>>>         w _Jv_RegisterClasses
>
>>> 000015fc d p.0
>
>>>
>
>>> Still I am not understanding what is the problem, please help.
>
>>
>
>> Like the message says, it cannot find in the C extension module the
>
>> symbol 'initpyodbc', which is the entry point function for
>
>> initialising the module.
>
>>
>
>> Thus the module has not been built properly or is broken in some way.
>
>>
>
>> Graham
>
>>
>
>>> Thanks,
>
>>> Rahul
>
>>>
>
>>> -----Original Message-----
>
>>> From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com]
>
>>> Sent: Friday, January 16, 2009 2:55 PM
>
>>> To: rahul
>
>>> Cc: mod_python at modpython.org
>
>>> Subject: Re: [mod_python] query regarding pyodbc
>
>>>
>
>>> 2009/1/16 rahul <rahul.warhekar at edisphere.com>:
>
>>>> Hello all,
>
>>>>
>
>>>>
>
>>>>
>
>>>> I am using RedHat Enterprise 4 linux on which I have python 2.5.4 and
>
>>>> mod_python 3.3.1 .
>
>>>>
>
>>>> Now when I install pyodbc package and I try to import it it is giving me
>
>>> an
>
>>>> error as
>
>>>>
>
>>>> ImportError : dynamic module does not define init function (initpyodbc)
>
>>>>
>
>>>>
>
>>>>
>
>>>> My pyodbc version is 2.1.14
>
>>>>
>
>>>> Any help regarding this will be greatly appreciated.
>
>>>
>
>>> Does it work when you try and import it from command line Python?
>
>>>
>
>>> Have you run 'nm' command on the .so file for the Python C extension
>
>>> module to see whether that function (initpyodbc) exists in the file?
>
>>>
>
>>> Graham
>
>>>
>
>>>
>
>>
>
>>


More information about the Mod_python mailing list