← Back to team overview

pyexiv2-developers team mailing list archive

Re: Test with python3

 

On 15/05/12 05:53, Robert Park wrote:
> On Mon, May 14, 2012 at 3:26 PM, Rob Healey <robhealey1@xxxxxxxxx> wrote:
>> As the development of Python3 is on fire right now, and everybody seems to
>> be upgrading their software to match, do you have any plans on upgrading
>> pyexiv2???
> Olivier has mentioned to me privately that his py3k port is stalled as
> of 6 months ago.
>
> I haven't had a lot of time to look at it, but I was hoping in the
> coming weeks I could contribute to a porting effort. Is there anybody
> else out there with the skills and the time to collaborate on this?
>
With some change in source, (see below) I can now write the exif.

I've only tested 'Description', 'Author', 'Copyright',
'DateTimeOriginal', 'UserComment'
and 'DocumentName'

IPTC and XMP not yet tested.

diff pyexiv2-0.3.2/src/pyexiv2/exif.py exif.py

179c179
<                 values = map(self._convert_to_python, values)
---
>                 values = list(map(self._convert_to_python, values))
195c195
<             raw_values = map(self._convert_to_string, value)
---
>             raw_values = list(map(self._convert_to_string, value))
315c315
<                 return long(value)
---
>                 return int(value)
358c358,359
<             elif isinstance(value, unicode):
---
>             elif isinstance(value, str):
>                 return value
369c370
<             if isinstance(value, unicode):
---
>             if isinstance(value, str):
394,399c395
<             if isinstance(value, unicode):
<                 try:
<                     return value.encode('utf-8')
<                 except UnicodeEncodeError:
<                     raise ExifValueError(value, self.type)
<             elif isinstance(value, str):
---
>             if isinstance(value, str):
417c413
<             if isinstance(value, (int, long)) and value >= 0:
---
>             if isinstance(value, int) and value >= 0:
423c419
<             if isinstance(value, (int, long)):
---
>             if isinstance(value, int):
441c437
<             if isinstance(value, unicode):
---
>             if isinstance(value, str):
513c509
<         cached = self._metadata._tags['exif'].keys()
---
>         cached = list(self._metadata._tags['exif'].keys())


diff pyexiv2-0.3.2/src/pyexiv2/metadata.py metadata.py

63c63
<         if filename is not None and isinstance(filename, unicode):
---
>         if filename is not None and not isinstance(filename, str):
423c423
<         except LookupError, error:
---
>         except LookupError as error:

Vincent

-- 
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte+7
<https://launchpad.net/qarte+7> . PaQager <https://launchpad.net/paqager>



References