Skip to content

Commit

Permalink
For running in Windows
Browse files Browse the repository at this point in the history
To run on Windows path seperator must be changed.
Also close_fds is not available on Windows.
  • Loading branch information
hakantkn committed Feb 20, 2014
1 parent 059e9c6 commit 8cea241
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions weka/classifiers.py
Expand Up @@ -30,7 +30,7 @@

BP = os.path.dirname(os.path.abspath(__file__))
CP = os.environ.get('WEKA_JAR_PATH', DEFAULT_WEKA_JAR_PATH)
for _cp in CP.split(':'):
for _cp in CP.split(os.pathsep):
assert os.path.isfile(_cp), ("Weka JAR file %s not found. Ensure the " + \
"file is installed or update your environment's WEKA_JAR_PATH to " + \
"only include valid locations.") % (_cp,)
Expand Down Expand Up @@ -283,7 +283,7 @@ def train(self, training_data, testing_data=None, verbose=False):
# Create new model file.
cmd = "java -cp %(CP)s %(classifier_name)s -t \"%(training_fn)s\" -T \"%(testing_fn)s\" -d \"%(model_fn)s\" %(ckargs)s" % args
if verbose: print cmd
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=sys.platform != "win32")
stdin, stdout, stderr = (p.stdin, p.stdout, p.stderr)
stdout_str = stdout.read()
stderr_str = stderr.read()
Expand Down Expand Up @@ -664,4 +664,4 @@ def test_updateable(self):

if __name__ == '__main__':
unittest.main()


0 comments on commit 8cea241

Please sign in to comment.