Skip to content
Advertisement

Tag: subprocess

Python loadarff fails for string attributes

I am trying to load an arff file using Python’s ‘loadarff’ function from scipy.io.arff. The file has string attributes and it is giving the following error. How to read the arff successfully? Answer Since SciPy’s loadarff converts containings of arff file into NumPy array, it does not support strings as attributes. In 2020, you can use liac-arff package. However, make

Subprocess call with exit status 128

Essentially, I am trying to use a subprocess call to checkout a git commit at a specific sha hash. However, I keep getting the error subprocess.CalledProcessError: Command ‘[‘git’, ‘checkout’, ’62bbce43e’]’ returned non-zero exit status 128. This is my code below: Answer A subprocess.check_output() call actually returns the output (and you can also get error output as well by passing a

Live-output / stream from Python subprocess

I am using Python and it’s subprocess library to check output from calls using strace, something in the matter of: However, this only gives me the output after the called subprocess already finished, which is very limiting for my use-case. I need a kind of “stream” or live-output from the process, so I need to read the output while the

Retain environment of helper python script in main script

I’ve one helper script which I want to call from main script which is acting as a Server. This main script looks like this: Now Client will invoke this helper script by providing it’s name to main script(Server). After execution I want to retain variables of helper script (i.e: a,b) in main script. I know one way is to return

Advertisement