From d5901525859dbb026de23e29986cab2a93f4bde2 Mon Sep 17 00:00:00 2001 From: Zok Muodov Date: Thu, 24 Dec 2015 00:53:33 +0100 Subject: [PATCH] fix relative import for py3 --- kociemba/__init__.py | 7 ++++--- setup.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/kociemba/__init__.py b/kociemba/__init__.py index 386c7e0..4274e8e 100644 --- a/kociemba/__init__.py +++ b/kociemba/__init__.py @@ -6,16 +6,17 @@ class SlowContextWarning(Warning): try: import os - from ckociembawrapper import ffi, lib + from .ckociembawrapper import ffi, lib cache_dir = os.path.join(os.path.dirname(__file__), 'cprunetables') def _solve(s): res = lib.solve(s.encode('utf-8'), cache_dir.encode('utf-8')) if res != ffi.NULL: - return ffi.string(res).strip() + return ffi.string(res).strip().decode('utf-8') else: raise ValueError('Error. Probably cubestring is invalid') -except ImportError: +except ImportError as e: + print(e) warnings.warn("Native version of the package is not available. " "We have to fallback to pure-Python implementation of " "the algorithm, which is usually many times slower. " diff --git a/setup.py b/setup.py index 8ba9402..ba5377a 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='kociemba', - version='1.0.1', + version='1.0.2', description='Python/C implementation of Herbert Kociemba\'s Two-Phase algorithm for solving Rubik\'s Cube', keywords='kociemba rubik cube solver twophase', url='https://github.com/muodov/kociemba',