diff --git a/pandas/__init__.py b/pandas/__init__.py index da4c146da3cfd..62de9a10e729b 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -3,17 +3,10 @@ __docformat__ = 'restructuredtext' try: - from . import hashtable, tslib, lib -except Exception: # pragma: no cover - import sys - e = sys.exc_info()[1] # Py25 and Py3 current exception syntax conflict - print e - if 'No module named lib' in str(e): - raise ImportError('C extensions not built: if you installed already ' - 'verify that you are not importing from the source ' - 'directory') - else: - raise + from pandas import hashtable, tslib, lib +except ImportError as e: # pragma: no cover + module = str(e).lstrip('cannot import name ') # hack but overkill to use re + raise ImportError("C extensions: {0} not built".format(module)) from datetime import datetime import numpy as np diff --git a/pandas/algos.pyx b/pandas/algos.pyx index cac9c5ccc7a6d..836101ecafa2d 100644 --- a/pandas/algos.pyx +++ b/pandas/algos.pyx @@ -57,7 +57,7 @@ cdef extern from "src/headers/math.h": double fabs(double) int signbit(double) -from . import lib +from pandas import lib include "skiplist.pyx" diff --git a/pandas/index.pyx b/pandas/index.pyx index 7d33d6083d0eb..85a83b745510f 100644 --- a/pandas/index.pyx +++ b/pandas/index.pyx @@ -15,8 +15,8 @@ import numpy as np cimport tslib from hashtable cimport * -from . import algos, tslib, hashtable as _hash -from .tslib import Timestamp +from pandas import algos, tslib, hashtable as _hash +from pandas.tslib import Timestamp from datetime cimport (get_datetime64_value, _pydatetime_to_dts, pandas_datetimestruct) @@ -34,7 +34,7 @@ try: import pytz UTC = pytz.utc have_pytz = True -except: +except ImportError: have_pytz = False PyDateTime_IMPORT @@ -42,8 +42,6 @@ PyDateTime_IMPORT cdef extern from "Python.h": int PySlice_Check(object) -# int PyList_Check(object) -# int PyTuple_Check(object) cdef inline is_definitely_invalid_key(object val): if PyTuple_Check(val):