Re: [f2py] wrapping c with f2py

Pearu Peterson <[email protected]>
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
Hi again,

Look at the first error message:

...
In file included from /tmp/tmp6MoTqW/src.linux-i686-2.6/fortranobject.c:2:
/tmp/tmp6MoTqW/src.linux-i686-2.6/fortranobject.h:7:20: error: Python.h:
No such file or directory
...

It means that you must install python developer package. Try, for example,

  sudo apt-get install python-dev

HTH,
Pearu


Ariel Balter wrote:
> Hi,
> I am trying to wrap c code with f2py.  I have found a couple of
> resources such as
> http://www.scipy.org/Cookbook/f2py_and_NumPy
> and this post
> http://cens.ioc.ee/pipermail/f2py-users/2005-February/001059.html
> 
> Since I am writing, you might guess I'm having some trouble.  I'm
> running ubuntu 9.10 and compiling with gfortran and gcc.  My python
> version is 2.6.4.
> 
> Here are my files:
> 
> // ---------- f2ctest.c ----------- //
> #include<stdio.h>
> 
> int f2ctest(int num)
> {
>  printf( "Test:%i",num);
>  return -1;
> }
> 
> // --------------------------------- //
> 
> #-------- f2c.pyf ----------- #
> python module f2c
>  interface
>    function f2ctest(num)
>      intent(c) f2ctest
>      integer f2ctest, num
>      intent(c) num
>    end function f2ctest
>  end interface
> end python module f2c
> #------------------------------- #
> 
> These are just the 2 example files in the post.  However, when I run
> "f2py -c f2c.pyf f2ctest.c", I get a lot of very bad looking output,
> full of the ominous word "error".  Since you probably have nothing
> better to do than to read it, I have attached it.
> 
> I would have posted this to the f2py forum, but I sincerely can't figure
> out how.  I got this by clicking on your email link on the above post.
> 
> Cheer, Ariel
> 
> -- 
> /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
> 
> Ariel I Balter, Ph.D.
> Postdoc
> Biological Monitoring/Modeling
> Fundamental and Computational Sciences Directorate
> 
> Pacific Northwest National Laboratory Mail:
> PO Box 999, MS P7-58,Richland, WA 99352
> Shipping:
> 790 6th Street, MS P7-58, Richland, WA 99354
> 
> Tel:  509-376-7605 Cell:  509-713-0087
> ariel.balter-Y2zl/[email protected] <mailto:ariel.balter-Y2zl/[email protected]>
> www.arielbalter.com <http://www.arielbalter.com>
> www.pnl.gov <http://www.pnl.gov> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> f2py-users mailing list
> f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
> http://cens.ioc.ee/mailman/listinfo/f2py-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.