[f2py] Acces to used module variables
<[email protected]> Thu, 29 Jul 2010 12:51:04 +0200
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Hello, I have a question about the functionality of f2py (actually its the functionality of fortran): Is it possible, to access variables, that are not deklared in my wrapped module, but in a module that is imported by my wrapped module? Here is an example: module mine use pimodule implicit none real::e contains subroutine init() call initpi() e = 2.7 end subroutine init end module mine module pimodule implicit none real::pi contains subroutine initpi() pi = 3.14 end subroutine initpi end module pimodule Now I wrap 'mine' and would like to read the variables "e" and "pi" from python. To access e is not the problem, the problem is pi! I do something like this: Python 2.6.4 (r264:75706, Jan 21 2010, 07:46:28) [GCC 4.1.2 20070115 (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from test import * >>> print mine.__doc__ e - 'f'-scalar init - Function signature: init() >>> mine.init() >>> mine.e array(2.7000000476837158, dtype=float32) >>> mine.pi Traceback (most recent call las): File "<stdin>", line 1, in <module> AttributeError: pi >>> mine.pimodule.pi Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: pimodule Do you know a solution for this problem? Maybe with the PUBLIC option? Thank you in advance Malte ----------------------------------------------------------------------------- Deutsches Zentrum für Luft- und Raumfahrt e.V. in der Helmholtz-Gemeinschaft Malte Mauelshagen Lilienthalplatz 7 38108 Braunschweig Tel.: 0531/295-2483