pyexiv2 can not open files with accents in filename on windows

Bug #332419 reported by Rob Wallace
2
Affects Status Importance Assigned to Milestone
pyexiv2
Fix Released
High
Olivier Tilloy

Bug Description

Code To produce bug:

# -*- coding: UTF-8 -*-
import pyexiv2

filename = u'û.jpg'

image = pyexiv2.Image(filename)
image.readMetadata()
print image.getComment()

Expected result:
 Image JPEG comment printed

Actual Result:
Traceback (most recent call last):
  File "accent_test.py", line 7, in <module>
    image = pyexiv2.Image(filename)
  File "C:\Python25\lib\site-packages\pyexiv2.py", line 397, in __init__
    libpyexiv2.Image.__init__(self, filename)
IOError: ├╗.jpg: Failed to open the data source: No such file or directory (2)

Fix:
Instead of using utf-8 encoding for the filename use the system file system coding as per the attached patch, this has been tested on both Windows and Linux.

Related branches

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

Thanks for the patch Rob, I'll make sure it lands into 0.2.

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

Patch committed with revision 281, along with unit tests.

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.