Passing the filename to the Image constructor as unicode fails

Bug #146313 reported by Olivier Tilloy
4
Affects Status Importance Assigned to Milestone
pyexiv2
Fix Released
Medium
Olivier Tilloy

Bug Description

This bug was reported by Michal Čihař <email address hidden>:

Somewhere inside lazygal, file name gets converted to unicode, when I pass it to pyexiv2, it fails:

  File "/usr/lib/python2.4/site-packages/pyexiv2.py", line 289, in
__init__ libpyexiv2.Image.__init__(self, filename)
Boost.Python.ArgumentError: Python argument types in
    Image.__init__(Image, unicode)
did not match C++ signature:
    __init__(_object*, std::string)

I think it should attempt to convert it to string - using str() in python "fixes" this issue.

Note: this bug might affect other places of the code and is indeed easily fixed using str().

Olivier Tilloy (osomon)
Changed in pyexiv2:
assignee: nobody → osomon
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Olivier Tilloy (osomon) wrote :

Fix committed with revision 69.

Changed in pyexiv2:
status: Confirmed → Fix Committed
Revision history for this message
nono (nonolemono) wrote :

Hi,

if there is an accent in the path then "str(filename)" fails.
Instead we should use filename.encode('utf-8') don't you think ?

That's what I put in my code and things works great!

Nono

Revision history for this message
Olivier Tilloy (osomon) wrote :

Verified as failing with Unicode characters such as accents.

Changed in pyexiv2:
status: Fix Committed → Confirmed
Revision history for this message
Olivier Tilloy (osomon) wrote :

Fix committed with revision 76. Tested with regular strings and unicode strings containing exotic characters such as accents.

Changed in pyexiv2:
status: Confirmed → Fix Committed
Olivier Tilloy (osomon)
Changed in pyexiv2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.