Trouble importing module using swig and python

Discussion in 'Python' started by Basha J P M, Oct 11, 2008.

  1. Basha J P M

    Basha J P M Guest

    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:


    $ 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.





    --
    View this message in context: http://www.nabble.com/Trouble-importing-module-using-swig-and-python-tp19930052p19930052.html
    Sent from the Python - python-list mailing list archive at Nabble.com.
     
    Basha J P M, Oct 11, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. stefan
    Replies:
    3
    Views:
    451
    stefan
    Dec 8, 2004
  2. plb
    Replies:
    2
    Views:
    371
  3. vduber6er
    Replies:
    2
    Views:
    259
    vduber6er
    May 14, 2006
  4. Pradnyesh Sawant

    doubt with importing module, given module name

    Pradnyesh Sawant, Apr 9, 2007, in forum: Python
    Replies:
    0
    Views:
    302
    Pradnyesh Sawant
    Apr 9, 2007
  5. -ecosys.com
    Replies:
    4
    Views:
    324
    Calvin Spealman
    Sep 28, 2007
Loading...

Share This Page