Re: [f2py] cancel fortran module inside python shell

Kevin Mitchell <[email protected]> Wed, 5 Jan 2011 13:02:51 -0700
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
As far as I know there is no good way to implement this. The problem
is that the Fortran code is called by the process running the python
shell. Therefore the two cannot be distinguished at the operating
system level. That said, it would be dangerous if python actually
heeded your request and ceased running the module midway through
because it might cause memory leaks or undefined behaviour since there
is no way for python to know what Fortran is actually doing so that it
can stop at an opportune time.

On 1/5/11, Mark Andrews <[email protected]> wrote:
> Hi,
> I have a simple question, sorry if the answer is out there and my
> googling missed it.
> To cancel or interrupt a running python script inside a python shell
> like e.g., ipython, I press 'ctrl+c'.
> If I write a pure fortran program and run it from a linux bash shell,
> I can also cancel by pressing "ctrl+c".
> However, if I write a fortran module for python using f2py and run
> that in a python shell, I can not cancel with "ctrl+c". The only way I
> can interrupt it is (with linux) issuing a kill command to the entire
> python shell process.
> I was wondering if there is something I am missing? Is there something
> I should add to the fortran code or maybe to the f2py command line
> flags?
> thanks,
> Mark
>
> _______________________________________________
> f2py-users mailing list
> f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
> http://cens.ioc.ee/mailman/listinfo/f2py-users
>