473,692 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with custom extension: help needed

I wrote a couple of custom dummy extensions in Python (one a pure Python
and the other a C) and i managed to compile and install them without a

[josevnz@linux00 37 TestNative]$ make
python2 setup.py build
running build
running build_py
creating build
creating build/lib.linux-i686-2.2
creating build/lib.linux-i686-2.2/test
copying src/python/test/Dummy.py -> build/lib.linux-i686-2.2/test
copying src/python/test/__init__.py -> build/lib.linux-i686-2.2/test
running build_ext
building 'test.NativeDum my' extension
creating build/temp.linux-i686-2.2
gcc -DNDEBUG -O2 -g -pipe -march=i386 -mcpu=i686 -D_GNU_SOURCE -fPIC
-I/usr/include/python2.2 -c src/c/dummy.c -o
gcc -shared build/temp.linux-i686-2.2/dummy.o -L/lib -lm -o

So far the RPM installation looks ok too and seems to be than the
installed files are on the proper location:

make rpm
moving build/bdist.linux-i686/rpm/SRPMS/python-TestNative-0.0-1.src.rpm
-> dist
build/bdist.linux-i686/rpm/RPMS/i386/python-TestNative-0.0-1.i386.rpm ->

[root@linux0037 root]# rpm -ihv
Preparing... ############### ############### #############
1:python-TestNative ############### ############### #############

[root@linux0037 root]# rpm -ql python-TestNative
But when i run a custom script that uses both extensions i got the
following error:

[josevnz@linux00 37 TestNative]$ ./scripts/Test.py
Traceback (most recent call last):
File "./scripts/Test.py", line 18, in ?
import test.Dummy
ImportError: No module named Dummy
[josevnz@linux00 37 TestNative]$
The script code seems normal to me:

#!/usr/bin/env python2
# Hello world to test native interfaces in Python
# Fix the path
import os.path
import sys
new_path=os.pat h.abspath(new_p ath)
sys.path.append (new_path)

if debug:
for path in sys.path:
print path

import test.Dummy
import test.NativeDumm y

argument1 = "Test string argument"
argument2 = 600000
dumber = test.Dummy.Dumm y("really dumb")
test.NativeDumm y(argument1, argument2)
Here is my setup.py file:

#!/usr/bin/env python2
# Hello world to test native interfaces in Python
from distutils.core import setup, Extension


extension1 = Extension('test .NativeDummy',
define_macros = [('MAJOR_VERSION ', VERSION),
include_dirs = ['/include'],
libraries = ['m'],
library_dirs = ['/lib'],
sources = ['src/c/dummy.c'])

setup (name = 'python-TestNative',
version = '0.0',
description = 'My practice native test with Python.',
author = 'Jose Vicente Nunez Zuleta',
author_email = 'ZZZZZ',
url = 'XXXX',
package_dir = {'' : 'src/python'},
packages = ['test'],
long_descriptio n = '''
My practice native test with Python.
Hope this works.
ext_modules = [extension1])

I'm using Python 2.2 on RedHat7.2

What do i need to fix so Python can load my extensions?

Thanks in advance,
Jose Vicente Nunez Zuleta (josevnz at newbreak dot com)
Newbreak LLC System Administrator
Jul 18 '05 #1
0 1759

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: John | last post by:
I tried to search for a solution to this, but I couldn't find one. Maybe I didn't look in the right place, but whatever.... Here is the problem - I have an extension "Myextension" created using SWIG from C++ code. I put this in my c:\php5\ext directory and pointed php.ini to load extensions from that directory. This is fine. However this extension depends upon some other custom DLLs I have coded in C++. The only way that the original...
by: Marco Bubke | last post by:
Hi I have read some mail on the dev mailing list about PEP 318 and find the new Syntax really ugly. def foo(x, y): pass I call this foo(1, 2), this isn't really intuitive to me! Also I don't like the brackets.
by: trexim | last post by:
Hi, I am trying to create a Web Reference for CSTA using the URL http://www.ecma-international.org/standards/ecma-348/csta-wsdl/csta-wsdl-all-operations.wsdl Visual .Net complains that: " The document was understood, but it could not be processed. - The WSDL document contains links that could not be resolved. - There was an error downloading
by: noone | last post by:
I upgraded VS 2003 and asked my ISP (MaximumASP) to upgrade the server to net 1.1. That was two weeks ago and I am having a problem that will not go away. When publishing the site from VS I get an error that 1.1 cannot be found. Tech takes a few days to figure it out and consult with MS before the come to the conclusion that a file called get_aspx_ver.aspx is missing or needed, since the file could not be found the get_aspx_ver.aspx ...
by: bryan | last post by:
If I understand correctly, I can write a custom handler for a given extension (say .abcd files) by writing a class that implements the IHttpHandler interface and then registering it in my web config file. Once I do that, how do I differentiate between different pages with the abcd extension, and write specific code for each page? (And keep that code with the page, similar to codebehind.?) Thanks, Bryan
by: CBVenkat | last post by:
Hi, I am trying to add a new extension to the WSDL definition to include the following tag: <foo:compress type="xxxxxx"> <foo:addon name="a1"> <foo:parameter name="thePart" value="xxxx"> </foo:extension> <foo:addon name="a2">
by: Flashster | last post by:
My program writes text to a file. Currently the files have a suffix of '.log' . I want to make sure that the user does not attempt to open a file that was not originally created by my program. I don't really want to write some code to the top of the text file that I'd have to filter out each time I read it, so how else would I do it? Would I perhaps: i) create a custom file type with a custom suffix and get the system to associate...
by: Michael Russell | last post by:
Hi all, Sorry for the repost, but I never received any response when I first asked this a few weeks ago. I would really appreciate some feedback on this, it's driving me nuts... I'm beginning the process of moving some projects from VS.Net 7 to VS2005. I'm having problems getting a Custom Build Step to work. In the dialog for the header file I want to perform the custom step on,
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of text and I can't find the error on why it isn't working. Any help is greatly appreciated. Here is the form
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.