]> granicus.if.org Git - liblinear/commitdiff
Change the path of loading *.dll and *.so to the relative path of linear.py.
authorpopo <popo@16e7d947-dcc2-db11-b54a-0017319806e7>
Wed, 16 Feb 2011 13:35:05 +0000 (13:35 +0000)
committerpopo <popo@16e7d947-dcc2-db11-b54a-0017319806e7>
Wed, 16 Feb 2011 13:35:05 +0000 (13:35 +0000)
python/linear.py

index 145f60f38ec8f81451dfc8bc7bebb805862be86e..e3327f75f0b92c51a6c057a86f7e1457dbb69597 100644 (file)
@@ -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',\