Ticket #1967 (closed: wontfix)

Opened 10 years ago

Last modified 5 years ago

Fortran code wrapped with f2py doesn't have its output redirected correctly

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: trivial Milestone: Release 2.6
Component: Framework Keywords:
Cc: Blocked By:
Blocking: Tester: Russell Taylor

Description

f2py is contained within numpy and allows a python interface to be generated for Fortran code.

Currently any Fortran routines that contain print statements do not function as expected in MantidPlot. The print output only ever gets seen on the command line and not where it would be expected in the scripting window.

Attached are the necessary windows files for f2py, gfortran and mingw along with a test module containing a hello() function from Steve King.

Change History

comment:1 Changed 10 years ago by Martyn Gigg

File are actually to big so I'll keep them for now.

comment:2 Changed 10 years ago by Martyn Gigg

There is also a problem with error translation in MantidPlot. If the fortran function has an error, i.e. cannot open a file, and f2py tries to raise an Exception then this kills MantidPlot.

comment:3 Changed 10 years ago by Nick Draper

  • Owner set to Martyn Gigg
  • Status changed from new to assigned

comment:4 Changed 10 years ago by Nick Draper

  • Milestone changed from Iteration 26 to Iteration 27

Bulk move of tickets to iteration 27, if your ticket is essential for Iteration 26 then move it back.

comment:5 Changed 10 years ago by Martyn Gigg

Further investigation has revealed that there is no ideal way to solve this.

The issue is that the Fortran routines write directly to the stdout file descriptor, which bypasses the Python stdout object. Our GUI and IDLE both pick up their standard output from the Python object.

One way is to capture all stdout to a file instead, as the fortran stdout can be captured this way and then output that in one go. It's not ideal though as this would have to be lagged behind the execution. We could consider threading a function that simply checks if stdout as been written and reads this as it goes along?

On the error translation side, I think this is going to be even more hopeless. It seems that f2py doesn't translate it's errors into Python exceptions as standard, this means that it has to be done by the person who writes the code which is less than ideal.

comment:6 Changed 10 years ago by Nick Draper

  • Milestone changed from Iteration 27 to Iteration 28

Bulk move of tickets at the end of iteration 27

comment:7 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 28 to Iteration 29

Bulk move of tickets at the end of iteration 28

comment:8 Changed 9 years ago by Martyn Gigg

  • Priority changed from major to trivial

comment:9 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 29 to Iteration 30

Accepted and assigned tickets moved at iteration 29 code freeze

comment:10 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 30 to Iteration 31

Bulk move of tickets to iteration 31 at the iteration 30 code freeze

comment:11 Changed 9 years ago by Nick Draper

  • Milestone changed from Iteration 32 to Iteration 33

Moved to iteration 33 at iteration 32 code freeze

comment:12 Changed 8 years ago by Nick Draper

  • Milestone changed from Release 2.1 to Release 2.2

Moved at end of release 2.1

comment:13 Changed 8 years ago by Nick Draper

  • Milestone changed from Release 2.2 to Release 2.3

comment:14 Changed 8 years ago by Nick Draper

  • Milestone changed from Release 2.3 to Release 2.4

Moved to release 2.4

comment:15 Changed 8 years ago by Martyn Gigg

  • Milestone changed from Release 2.4 to Release 2.5

comment:16 Changed 7 years ago by Nick Draper

  • Milestone changed from Release 2.5 to Release 2.6

Moved to r2.6 at the end of r2.5

comment:17 Changed 7 years ago by Martyn Gigg

  • Status changed from assigned to accepted

comment:18 Changed 7 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to wontfix

I don't think there is anything that can be done here.

comment:19 Changed 7 years ago by Russell Taylor

  • Status changed from verify to verifying
  • Tester set to Russell Taylor

comment:20 Changed 7 years ago by Russell Taylor

  • Status changed from verifying to closed

Fine by me. I personally think our support for anything fortranny should be minimal.

comment:21 Changed 7 years ago by Nick Draper

  • Component changed from Mantid to Framework

comment:22 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 2814

Note: See TracTickets for help on using tickets.