[python-hdf5storage] 141/152: Fixed bug on Python 2.6 where byterray.fromhex was given a non-unicode argument.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag 0.1
in repository python-hdf5storage.

commit 7aa9e8a76ed6b4bddbee16c64188564456872fcf
Author: Freja Nordsiek <fnordsie at gmail.com>
Date:   Sun Feb 16 00:47:08 2014 -0500

    Fixed bug on Python 2.6 where byterray.fromhex was given a non-unicode argument.
---
 hdf5storage/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hdf5storage/__init__.py b/hdf5storage/__init__.py
index f71d9e0..857eb38 100644
--- a/hdf5storage/__init__.py
+++ b/hdf5storage/__init__.py
@@ -1033,9 +1033,11 @@ def write(data, path='/', filename='data.h5', truncate_existing=False,
         b = bytearray(s + (128-12-len(s))*' ', encoding='utf-8')
 
         # Add 8 nulls (0) and the magic number (or something) that
-        # MATLAB uses.
+        # MATLAB uses. Lengths must be gone to to make sure the argument
+        # to fromhex is unicode because Python 2.6 requires it.
 
-        b.extend(bytearray.fromhex('00000000 00000000 0002494D'))
+        b.extend(bytearray.fromhex(
+                 b'00000000 00000000 0002494D'.decode()))
 
         # Now, write it to the beginning of the file.
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-hdf5storage.git



More information about the debian-science-commits mailing list