[f2py] f2py AttributeError

"Gabor Kalman" <[email protected]> Sat, 02 Mar 2013 11:55:46 -0800
Newsgroups gmane.comp.python.f2py.user
Message-ID <83A0F08367AC43A8A83FDF290D975C4D@ToshibaGPC>
This is a multi-part message in MIME format.

--===============4234710397978503293==
Content-type: multipart/alternative;
 boundary="----=_NextPart_000_0003_01CE173C.E026F850"

This is a multi-part message in MIME format.

------=_NextPart_000_0003_01CE173C.E026F850
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

I hope that  I can save someone=92s time with the following message:

I wrote a small script in gfortran:
!-----------------------
file: RK4-test.f90

module aa

subroutine RK4(args)   !!!please note RK4 is in all CAPS
...
end subroutine RK4
....

end module aa
!------------------------------------
then compiled it into lib1.pyd

then with the f2py  driver:
#------------------------------
test.py

import lib1
s=3Dlib1.aa.RK4(args)
print s
#------------------------------
I got an obscure message:   AttributeError in RK4

After a lot of searches I was ready to give up,
but then I ACCIDENTLY Ire-wrote the driver as:
#-------------------------------------------
test.py

import lib1
s=3Dlib1.aa.rk4(args)  !!!please note rk4 in LOWER-CASE
print s
#----------------------------------------
and  SUDDENLY everything worked OK!!!!

Yes, while I know Python is case-sensitive, but this still surprised me.



------=_NextPart_000_0003_01CE173C.E026F850
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<HTML><HEAD></HEAD>
<BODY dir=3Dltr>
<DIV dir=3Dltr>
<DIV style=3D"FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV><FONT size=3D5><STRONG>I hope that&nbsp; I can save someone=92s =
time with the=20
following message:</STRONG></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>I wrote a small script in gfortran:</DIV>
<DIV>!-----------------------</DIV>
<DIV>file: <STRONG>RK4-test.f90</STRONG></DIV>
<DIV>&nbsp;</DIV>
<DIV>module aa</DIV>
<DIV>&nbsp;</DIV>
<DIV>subroutine RK4(args)&nbsp;&nbsp; !!!please note RK4 is in all =
CAPS</DIV>
<DIV>...</DIV>
<DIV>end subroutine RK4</DIV>
<DIV>....</DIV>
<DIV>&nbsp;</DIV>
<DIV>end module aa</DIV>
<DIV>!------------------------------------</DIV>
<DIV>then compiled it into <STRONG>lib1.pyd</STRONG></DIV>
<DIV>&nbsp;</DIV>
<DIV>then with the f2py&nbsp; driver:</DIV>
<DIV>#------------------------------</DIV>
<DIV><STRONG>test.py</STRONG></DIV>
<DIV>&nbsp;</DIV>
<DIV>import lib1</DIV>
<DIV>s=3Dlib1.aa.RK4(args)</DIV>
<DIV>print s</DIV>
<DIV>#------------------------------</DIV>
<DIV>I got an obscure message:&nbsp;&nbsp; <STRONG>AttributeError in=20
RK4</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV>After a lot of searches I was ready to give up,</DIV>
<DIV>but then I ACCIDENTLY Ire-wrote the driver as:</DIV>
<DIV>#-------------------------------------------</DIV>
<DIV><STRONG>test.py</STRONG></DIV>
<DIV>&nbsp;</DIV>
<DIV>import lib1</DIV>
<DIV>s=3Dlib1.aa.rk4(args)&nbsp; !!!please note rk4 in LOWER-CASE</DIV>
<DIV>print s</DIV>
<DIV>#----------------------------------------</DIV>
<DIV>and&nbsp; SUDDENLY everything worked OK!!!!</DIV>
<DIV>&nbsp;</DIV>
<DIV>Yes, while I know Python is<STRONG> case-sensitive</STRONG>, but =
this still=20
surprised me.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></DIV></DIV></BODY></HTML>

------=_NextPart_000_0003_01CE173C.E026F850--



--===============4234710397978503293==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
f2py-users mailing list
f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
http://cens.ioc.ee/mailman/listinfo/f2py-users

--===============4234710397978503293==--