[C++-sig] Problems loading installed extensions: help needed

Jose Vicente Nunez Zuleta josevnz at newbreak.com
Thu Sep 11 05:00:40 CEST 2003


Hmmm, thats sounds weird. I mean, why the debug symbols should matter to
the Python interpreter?

Also, renaming the module to pyd should not matter, i guess Python
should be able to load the extension as an 'so'.

Any ideas?

How i can check what Python is trying to load at runtime? (like a
verbose flag)

Thanks,

JV.
On Wed, 2003-09-10 at 19:54, eric andersonT wrote:
> Was NativeDummy.so built with the DEBUG preprocessor flag defined? I
> could be wrong here, but I'm pretty sure that if you built the module
> with the DEBUG flag, you must load it with a debug build of the python
> interpreter.
> 
> Eric
> 
> -----Original Message-----
> From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org] On
> Behalf Of Jose Vicente Nunez Z
> Sent: Wednesday, September 10, 2003 4:48 PM
> To: Development of Python/C++ integration
> Subject: [C++-sig] Problems loading installed extensions: help needed
> 
> 
> Greetings,
> 
> I wrote a Pythin extension module but for some reason i cannot load it
> at runtime:
> 
> 
> [josevnz at linux0037 TestNative]$ ./scripts/Test.py
> Traceback (most recent call last):
>   File "./scripts/Test.py", line 6, in ?
>     import test.NativeDummy
> ImportError: No module named NativeDummy
> [josevnz at linux0037 TestNative]$ ./scripts/Test.py
> Traceback (most recent call last):
>   File "./scripts/Test.py", line 6, in ?
>     import test.NativeDummy
> ImportError: No module named NativeDummy
> 
> But it seems to be installed on the proper location:
> 
> 
> [root at linux0037 dist]# rpm -ihv --force python-TestNative-0.0-1.i386.rpm
> Preparing...                ###########################################
> [100%]
>    1:python-TestNative      ###########################################
> [100%]
> [root at linux0037 dist]# rpm -ql python-TestNative
> /usr/lib/python2.2/site-packages/test/Dummy.py
> /usr/lib/python2.2/site-packages/test/Dummy.pyc
> /usr/lib/python2.2/site-packages/test/NativeDummy.so
> /usr/lib/python2.2/site-packages/test/__init__.py
> /usr/lib/python2.2/site-packages/test/__init__.pyc
> 
> So far this is the code (the extension is called NativeDummy):
> 
> #!/usr/bin/env python2
> #
> # Hello world to test native interfaces in Python
> #
> import test.NativeDummy
> import test.Dummy
> 
> argument1 = "Test string argument"
> argument2 = 600000
> test.NativeDummy(argument1, argument2)
> dumber = test.Dummy.Dummy("really dumb")
> 
> This is my setup.py file (so far i think all here is ok):
> 
> #!/usr/bin/env python2
> #
> # Hello world to test native interfaces in Python
> #
> from distutils.core import setup, Extension
> 
> VERSION=0
> RELEASE=0
> 
> extension1 = Extension('test.NativeDummy',
>                     define_macros = [('MAJOR_VERSION', VERSION),
>                                      ('MINOR_VERSION', RELEASE)],
>                     include_dirs = ['/include'],
>                     libraries = ['m'],
>                     library_dirs = ['/lib'],
>                     sources = ['src/c/dummy.c'])
> 
> setup (name = 'python-TestNative',
>        version = VERSION,
>        description = 'My practice native test with Python.',
>        author = 'ZZZZ',
>        author_email = 'XXX',
>        url = 'SSSS',
>        package_dir = {'' : 'src/python'},
>        packages = ['test'],
>        long_description = '''
> My practice native test with Python.
> Hope this works.
> ''',
>        ext_modules = [extension1])
> 
> This is my current directory layout:
> 
> [josevnz at linux0037 TestNative]$ find ./
> ./
> ./Makefile
> ./src
> ./src/python
> ./src/python/test
> ./src/python/test/Dummy.py
> ./src/python/test/__init__.py
> ./src/python/__init__.py
> ./src/c
> ./src/c/dummy.c~
> ./src/c/dummy.c
> ./setup.py
> ./.setup.py.swp
> ./scripts
> ./scripts/Test.py
> ./scripts/Test.py~
> ./scripts/.Test.py.swp
> ./dist
> ./dist/python-TestNative-0.0.tar.gz
> ./dist/python-TestNative-0.0-1.src.rpm
> ./dist/python-TestNative-0.0-1.i386.rpm
> ./README.txt
> ./build
> ./build/bdist.linux-i686
> ./build/bdist.linux-i686/rpm
> ./build/bdist.linux-i686/rpm/SOURCES
> ./build/bdist.linux-i686/rpm/SOURCES/python-TestNative-0.0.tar.gz
> ./build/bdist.linux-i686/rpm/SPECS
> ./build/bdist.linux-i686/rpm/SPECS/python-TestNative.spec
> ./build/bdist.linux-i686/rpm/BUILD
> ./build/bdist.linux-i686/rpm/RPMS
> ./build/bdist.linux-i686/rpm/RPMS/i386
> ./build/bdist.linux-i686/rpm/SRPMS
> ./MANIFEST
> 
> 
> I'm using Python 2.2, on Redhat 7.2
> 
> 
> Any ideas what i'm doing wrong?
> 
> 
> 
> 
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
> 
> 
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
-- 
Jose Vicente Nunez Zuleta <josevnz at newbreak.com>
Newbreak LLC





More information about the Cplusplus-sig mailing list