473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Trouble importing module using swig and python

I am beginner in python.
I am working through the tutorial examples from http://www.swig.org/ and have run into some problems. I took the following command instructions from the tutorial on swig.org:

http://www.swig.org/tutorial.html

I have written example.c and example.i as described in the above tutorial. My first attempt at compiling the libraries was this:


Expand|Select|Wrap|Line Numbers
  1. $ swig -python example.i
it should produce example.py and example_wrap.c files . But i am not getting example.py file in the folder where i am executing swig -python example.i

But with example_wrap.c file i can able to produce _example.so shared object like


gcc -c example.c example_wrap.c \
-I/vobs/tsp/tools/PYTHON/include/python2.5

gcc -shared example.o example_wrap.o -o _example.so



and doing

ld -shared example.o example_wrap.o -o _example.so

and when iam trying to import from python like

import example

it is saying no module named example.

My first Question is that should i get example.py in folder and second Question is that if it is not neccessary then where i am going wrong ??
Please help me in this regard.

regards,
basha.
Oct 11 '08 #1
0 1120

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: David Eger | last post by:
I'm trying to make a very simple extension which will return a new copy of a C++ string object to python, and I'm segfaulting in the process. I'm using Python 2.2.2, SWIG 1.3.17 and g++ 3.3. Am I...
7
by: Carl Waldbieser | last post by:
I tried to adapt the instructions for building the M2Crypto module (http://sandbox.rulemaker.net/ngps/m2/INSTALL.html) to build a version compatible with Python2.3, but I've had some mixed results....
2
by: Rick Olson | last post by:
I'm trying to add a Tkinter interface to an existing C program with embedded python, but seem to have trouble importing Tkinter (or accessing it). I tried a simple program that would run the...
2
by: Chris Hodapp | last post by:
I have seen messages posted about this before, and there is a clear reference to it in the manual, but I have been unable to find a solution. I'm on Slackware 9.1, kernel 2.6.0-test11, using...
0
by: Bill Davy | last post by:
I am working with MSVC6 on Windows XP. I have created an MSVC project called SHIP I have a file SHIP.i with "%module SHIP" as the first line (file is below). I run SHIP.i through SWIG 1.3.24...
0
by: Brandon Metcalf | last post by:
I come from a Perl and C background and have been given an application written in Python to maintain and I know very little about Python. I'm having trouble at run time with importing modules. ...
0
by: Carl Douglas | last post by:
Hi Python fans, I am developing a DLL that is loaded by a host application on windows. I'm using python 2.5. My DLL uses an embedded python interpreter which can access the host application...
2
by: John Pye | last post by:
Hi all I understand that I can't hope to pass a FILE* from the Windows version of Python into a SWIG module that I've built using MinGW gcc/g+ +, because apparently the FILE* structure are...
1
by: Harika | last post by:
hi everybody Iam learning python. I have to write test scripts for c files. I did using swig and python. Using python i give input to a function and gets the output and shown using python script...
0
by: Basha J P M | last post by:
I am beginner in python. I am working through the tutorial examples from http://www.swig.org/ and have run into some problems. I took the following command instructions from the tutorial on...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.