En Sun, 21 Sep 2008 19:42:10 -0300, Blubaugh, David A. <[EMAIL PROTECTED]> escribió:

Sir,
Thank you for your reply. This is as to how I developed my .pyd file. I entered the following commands within my MS-DOS prompt within Windows XP:

C:\python25\Scripts> C:\python25\python f2py.py -c --fcompiler=gnu95 --compiler=mingw32 -m hello hello.f90

I am using the gfortran compiler, that was prescribed to use, as well as, the required commands on the following website:

http://www.scipy.org/F2PY_Window <https://webmail.belcan.com/exchweb/bin/redir.asp?URL=http://www.scipy.org/F2PY_Window>

I comes down to that yes, I am able to generate a .pyd file, which was generated by f2py. However, when I tried to import this file into my python script program I was given the following error:
error 193??
I do not know as to what I am doing incorrectly, since I am generating a .pyd file by f2py? If I am doing anything that is incorrect, then why am I EVEN ABLE TO GENERATE A .PYD FILE IN THE FIRST PLACE??? Any Help will be greatly appreciated!!!!!

Below there is a transcript of a compile session. I've used a somewhat old version of mingw and g77, scipy 1.1.1, python 2.5.2:

C:\TEMP\for>dir /b
dscal.for

C:\TEMP\for>type dscal.for
       SUBROUTINE DSCAL(N, ALPHA, X)
*
*      X <- ALPHA * X
*
       INTEGER N
       DOUBLE PRECISION ALPHA
       DOUBLE PRECISION X(*)

       DO I = 1, N
          X(I) = ALPHA * X(I)
       END DO
       WRITE (*,*) ALPHA
       RETURN
       END


C:\TEMP\for>g77 --version
GNU Fortran (GCC) 3.4.2 (mingw-special)
Copyright (C) 2004 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
or type the command `info -f g77 Copying'.

C:\TEMP\for>python -V
Python 2.5.2

C:\TEMP\for>python c:\apps\python25\scripts\f2py.py -v
2_5590

C:\TEMP\for>python c:\apps\python25\scripts\f2py.py -c -m dscal dscal.for
[...lots of output...]
Found executable c:\apps\mingw\bin\g77.exe
gnu: no Fortran 90 compiler found
customize Mingw32CCompiler using scons
Found executable c:\apps\mingw\bin\g++.exe
[...]
gcc -mno-cygwin -O2 -Wall -Wstrict-prototypes -Ic:\docume~1\gabriel\config~1\tem p\tmpoygjnk\src.win32-2.5 -IC:\Apps\Python25\lib\site-packages\numpy\core\includ e -IC:\Apps\Python25\include -IC:\Apps\Python25\PC -c c:\docume~1\gabriel\config ~1\temp\tmpoygjnk\src.win32-2.5\dscalmodule.c -o c:\docume~1\gabriel\config~1\te
mp\tmpoygjnk\Release\docume~1\gabriel\config~1\temp\tmpoygjnk\src.win32-2.5\dsca
lmodule.o
gcc -mno-cygwin -O2 -Wall -Wstrict-prototypes -Ic:\docume~1\gabriel\config~1\tem p\tmpoygjnk\src.win32-2.5 -IC:\Apps\Python25\lib\site-packages\numpy\core\includ e -IC:\Apps\Python25\include -IC:\Apps\Python25\PC -c c:\docume~1\gabriel\config ~1\temp\tmpoygjnk\src.win32-2.5\fortranobject.c -o c:\docume~1\gabriel\config~1\
temp\tmpoygjnk\Release\docume~1\gabriel\config~1\temp\tmpoygjnk\src.win32-2.5\fo
rtranobject.o
[...]
c:\apps\mingw\bin\g77.exe -g -Wall -mno-cygwin -g -Wall -mno-cygwin -shared c:\d
ocume~1\gabriel\config~1\temp\tmpoygjnk\Release\docume~1\gabriel\config~1\temp\t
mpoygjnk\src.win32-2.5\dscalmodule.o c:\docume~1\gabriel\config~1\temp\tmpoygjnk
\Release\docume~1\gabriel\config~1\temp\tmpoygjnk\src.win32-2.5\fortranobject.o
c:\docume~1\gabriel\config~1\temp\tmpoygjnk\Release\dscal.o -Lc:\apps\mingw\lib -Lc:\apps\mingw\lib\gcc\mingw32\3.4.2 -LC:\Apps\Python25\libs -LC:\Apps\Python25
\PCBuild -lpython25 -lg2c -o .\dscal.pyd
[...]

C:\TEMP\for>dir /b
dscal.for
dscal.pyd

C:\TEMP\for>python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
py> import numpy
py> import dscal
py> print dscal.dscal.__doc__
dscal - Function signature:
  dscal(n,alpha,x)
Required arguments:
  n : input int
  alpha : input float
  x : input rank-1 array('d') with bounds (*)

py> v = numpy.array([1,2,3,4,5], 'd')
py> print v
[ 1.  2.  3.  4.  5.]
py> dscal.dscal(len(v), 2, v)
  2.
py> print v
[  2.   4.   6.   8.  10.]

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to