Convert Exiv2 exceptions to GError
Submitted by Valencia Maintainers
Link to original bug (#712432)
Description
---- Reported by valencia-maint@gnome.bugs 2013-08-03 04:23:00 -0700 ----
Original Redmine bug id: 7297
Original URL: http://redmine.yorba.org/issues/7297
Searchable id: yorba-bug-7297
Original author: Alessandro Tanasi
Original description:
I am using gevix2 0.4.90-0ubuntu1 and when procesing a bunch of images inside a python script i got errors directly printed to stderr in this format:
** (process:27945): WARNING **: error message
Why they aren't handled via exceptions but silently printed to screen?
Related issues: related to gexiv2 - Feature #7318: GDateTime accessor (Open)
---- Additional Comments From valencia-maint@gnome.bugs 2013-09-19 11:24:00 -0700 ----
History
Comment 1
Updated by Jim Nelson 3 months ago
- Status changed from Open to Need Information
Can you tell us what messages you're seeing printed to the console?
Comment 2
Updated by Alessandro Tanasi 3 months ago
Example:
** (process:4772): CRITICAL **: Offset of directory Image, entry 0x9c9d is out of bounds: Offset = 0x00000000; truncating the entry
** (process:4772): CRITICAL **: Offset of directory Image, entry 0xea1c is out of bounds: Offset = 0x00000000; truncating the entry
** (process:4772): CRITICAL **: Offset of directory Photo, entry 0xea1c is out of bounds: Offset = 0x00000000; truncating the entry
** (process:4772): WARNING **: Invalid key `Iptc.Application2.Caption'
Comment 3
Updated by Jim Nelson 3 months ago
- Subject changed from Errors printedd to stderr to Convert Exiv2 exceptions to GError
- Category set to interface
- Status changed from Need Information to Open
The first three errors are emitted by Exiv2, the library gexiv2 wraps. They are never presented to gexiv2 to be thrown as exceptions. The last error message is, I believe, an exception from Exiv2 being logged.
If you want to control whether or not those first three messages are displayed (and others like them), gexiv2 has an interface for that: gexiv2_log_set_handler() allows for you to install a callback and determine what, if anything, to print.
I've updated the ticket title to reflect what's being asked here. This would be an interface change, which I don't believe we'll be doing in the next release.
Comment 4
Updated by Alessandro Tanasi about 1 month ago
I am migrating an application from pyexiv and this never happened, errors was handled.
I see the interface you are talking but it's for C, and I am using Gexiv via python code, or is there a way to silent ti from python code?
Comment 5
Updated by Jim Nelson about 1 month ago
Because gexiv2 is written in C, the errors should be generated there. I suppose the Python bindings could convert result codes into GErrors and throw them (I don't know much Python), but ultimately we'd like for this to happen in the library itself.
--- Bug imported by chaz@yorba.org 2013-11-16 14:44 UTC ---
This bug was previously known as bug 7297 at http://redmine.yorba.org/show_bug.cgi?id=7297
Unknown version " in product gexiv2. Setting version to "!unspecified". Unknown milestone "unknown in product gexiv2. Setting to default milestone for this product, "---". Setting qa contact to the default for this product. This bug either had no qa contact or an invalid one. Resolution set on an open status. Dropping resolution