Comments (5)
So what's your approach?
I use the fexception project which I wrote, available on GitHub:
https://github.com/citibob/fexception
With this, I can throw exceptions in Fortran code and catch them in Python
code.
-- Bob
On Fri, Dec 11, 2015 at 2:59 PM, Mahé Perrette [email protected]
wrote:
Hi James,
Great project, much potential to solve common annoyances when wrapping
modern *f90 code. Both type-passing (f90wrap) and Exception catching are
very useful features, actuallly all of f2py-f90wrap are useful !When testing it out though, exception catching did not work as smoothly as
hoped: just calling stop did crash the fortran program, as with f2py.
Calling f90wrap_error_abort or even quippy_error_abort (as grepped in
f90wrap/patch_f2py) did not help either ...So what's your approach?
Thanks again.
—
Reply to this email directly or view it on GitHub
#36.
from f90wrap.
The default is actually f90wrap_abort
. You can override the name of a function called on aborts with the -a
command line option to f90wrap
.
Thanks for spotting the defunct reference to quippy_error_abort
in patch, I've updated that to fix this.
from f90wrap.
I just looked at this in slightly more detail, and it appears you can't currently change the abort routine name- it works if you trigger exceptions from Fortran with call f90wrap_abort("error message")
, but not if you change the name with the -a
argument as the abort function is currently hard-coded in f2py-f90wrap
.
I'll leave this issue open to mark the problem - pull requests welcome!
from f90wrap.
Nice !! Many thanks. Sure changing the name would be fine (consistent with the docs...), but for now it is a reasonable workaround to have raise_exception
defined somewhere (as it is the case in my code currently) to perform call f90wrap_abort("error message")
or stop("error message)
depending on whether it is used standalone or from f90wrap.
You did a fine work with this package. I can see how this will change a couple of things for the better in a research workflow involving model development. You might hear from me soon. Pull requests upon need. Cheers.
from f90wrap.
Note that in gfortran (v5.4.0) -fcheck=recursion
(implied by -fcheck=all
) must be deactivated otherwise a Fortran Runtime error occurs on the subsequent call: Fortran runtime error: Recursive call to nonrecursive procedure ...
Workaround: when debugging instead of -fcheck=all
I use all but "recursion": -fcheck=array-temps,bounds,do,mem,pointer
.
from f90wrap.
Related Issues (20)
- Windows missing dll error when building and running examples on Windows with Python 3.8> HOT 15
- IndentationError with python 3.9 HOT 5
- Extra (unnecessary) newline character in .py file for long variable names HOT 3
- more explanations on the provided examples HOT 2
- Handling reserved Python words in f90wrap HOT 6
- Help wrapping a project HOT 7
- Data type determined at run time
- Issues with Compiling MPI Program HOT 3
- Support for Intel oneAPI2022
- multidimensional arrays in derived types broken if compiled with long integers as default HOT 1
- Python 3.11 support HOT 8
- Pre-build f90wrap wheels for windows HOT 3
- Derived types containing allocatable character arrays
- `integer, value, intent(in)`/`integer, value` arguments converted to/wrapped as `real`
- Wrong module class name in a call to `f90wrap.runtime.FortranDerivedTypeArray` HOT 2
- numpy > 1.23 support HOT 2
- Switch to pyproject.toml based build system HOT 7
- duplicate symbol in formal argument list HOT 2
- Issues on Mac OS X - for f90wrap 0.2.12 HOT 1
- BUG: Routines including procedure arguments (callbacks) are excluded HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from f90wrap.