amueller / gco_python

Python wrappers for GCO alpha-expansion and alpha-beta-swaps
137 stars 64 forks source link

improvement : exceptions with error description message #11

Open g-raffy opened 8 years ago

g-raffy commented 8 years ago

Hi, I made some modifications so that from now on, whenever an exception is raised in the graph cut c++ code, the message detailing the reason of the failure is displayed (graph-cut c++ exceptions are translated into python exceptions). Without this change, whenever the graph code fails, a c++ exception (with a message detailing the reason of failure) is raised, but the description of the error is lost when translated into python exception: as a result, the user has no message to help him to understand why graph cut optimization failed.

amueller commented 8 years ago

Thanks. Unfortunately I currently don't have tests or continuous integration. I'd like to set that up before merging probably, and I'm not sure when I could do that. Would you mind adding a small tests showing what you added?

Thanks!

g-raffy commented 8 years ago

Hi again Andreas (and thanks for your gco_python project, by the way!), My changes are simply addressing the issue you mentioned in the readme file : "Unfortunately -I have not figured out yet how to convert C++ errors to Python." I made this change because I encountered these unknown exception that were raised when running graph cut optimization on some of my data with some of my settings, so I'm not sure what you expect from me : do you want me to send you a minimal python script along with some data files that raise an exception for illustration ?

amueller commented 8 years ago

The best thing would be to add a unit test using nose but a small script is also ok.