diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-03-19 00:01:24 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-03-19 00:01:24 +0100 |
commit | 0e3fa8402a28572ca94c98df964fc3352800c82f (patch) | |
tree | e23c4df75ae5fb7efa4048d2385551b46a974935 | |
parent | a7924a66bfa35eaf9050645d5eac9e7117a1f4ac (diff) | |
download | pyexiv2-0e3fa8402a28572ca94c98df964fc3352800c82f.tar.gz |
Do not try to encode filename if it is None,
which happens when instantiating an ImageMetadata from a buffer.
-rw-r--r-- | src/pyexiv2/metadata.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pyexiv2/metadata.py b/src/pyexiv2/metadata.py index 6dbe190..730e99f 100644 --- a/src/pyexiv2/metadata.py +++ b/src/pyexiv2/metadata.py @@ -55,7 +55,9 @@ class ImageMetadata(object): :param filename: path to an image file :type filename: string """ - self.filename = filename.encode(sys.getfilesystemencoding()) + self.filename = filename + if filename is not None: + self.filename = filename.encode(sys.getfilesystemencoding()) self._image = None self._keys = {'exif': None, 'iptc': None, 'xmp': None} self._tags = {'exif': {}, 'iptc': {}, 'xmp': {}} |