From 288018195006a76508133a440d9dde79f11cf02e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 28 May 2014 23:16:52 -0400 Subject: [PATCH] BF: reading stata files - unpack read value describing stored byte order Otherwise comparison would always result in "low endian" --- pandas/io/stata.py | 2 +- pandas/io/tests/test_stata.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 187a5f5d55533..b67a1be8d43d6 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -561,7 +561,7 @@ def _read_header(self): raise ValueError("Version of given Stata file is not 104, " "105, 108, 113 (Stata 8/9), 114 (Stata " "10/11), 115 (Stata 12) or 117 (Stata 13)") - self.byteorder = self.path_or_buf.read(1) == 0x1 and '>' or '<' + self.byteorder = struct.unpack('b', self.path_or_buf.read(1))[0] == 0x1 and '>' or '<' self.filetype = struct.unpack('b', self.path_or_buf.read(1))[0] self.path_or_buf.read(1) # unused diff --git a/pandas/io/tests/test_stata.py b/pandas/io/tests/test_stata.py index a83f8b3a9521f..b4be08c6b1106 100644 --- a/pandas/io/tests/test_stata.py +++ b/pandas/io/tests/test_stata.py @@ -19,9 +19,6 @@ from pandas.util.misc import is_little_endian from pandas import compat -if not is_little_endian(): - raise nose.SkipTest("known failure of test_stata on non-little endian") - class TestStata(tm.TestCase): def setUp(self):