From: popo Date: Wed, 16 Feb 2011 13:35:05 +0000 (+0000) Subject: Change the path of loading *.dll and *.so to the relative path of linear.py. X-Git-Tag: v180~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9cf949fd928284f300e1807545b80c99fe0b709f;p=liblinear Change the path of loading *.dll and *.so to the relative path of linear.py. --- diff --git a/python/linear.py b/python/linear.py index 145f60f..e3327f7 100644 --- a/python/linear.py +++ b/python/linear.py @@ -3,6 +3,7 @@ from ctypes import * from ctypes.util import find_library import sys +import os # For unix the prefix 'lib' is not considered. if find_library('linear'): @@ -11,9 +12,11 @@ elif find_library('liblinear'): liblinear = CDLL(find_library('liblinear')) else: if sys.platform == 'win32': - liblinear = CDLL('../windows/liblinear.dll') + liblinear = CDLL(os.path.join(os.path.dirname(__file__),\ + '../windows/liblinear.dll')) else: - liblinear = CDLL('../liblinear.so.1') + liblinear = CDLL(os.path.join(os.path.dirname(__file__),\ + '../liblinear.so.1')) # Construct constants SOLVER_TYPE = ['L2R_LR', 'L2R_L2LOSS_SVC_DUAL', 'L2R_L2LOSS_SVC', 'L2R_L1LOSS_SVC_DUAL',\