BUG: fixed attribute error when running on Python 2