python subprocess shouldn't run from within the folder -


i trying use c&c nlp library in mac , uses terminal interface. naturally i'm trying run command python, here's happens:

candc:could not open model configuration file reading:models/config   

turns out candc should not called same directory, , should called outside of binary folder, "bin/candc". how can make work?

this code:

cmd="candc/bin/candc --models models"   subprocess.check_output('{} | tee /dev/stderr'.format( cmd ), shell=true) 

pass cwd argument desired working directory.

for example, if want run bin/candc candc directory:

import os cmd="bin/candc --models models"   subprocess.check_output('{} | tee /dev/stderr'.format( cmd ), shell=true, cwd=os.path.abspath('candc')) 

(i'm not sure whether need os.path.abspath. test both , without it.)


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -