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
Tag: subprocess
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
Is there a way to get the error raised from a Python program outside Docker container and handle it?
I have a container that runs a Python program and it can run in two ways, using docker exec in the localhost terminal or by making an API Rest request (that is outside the container) which executes the same command as it would be done by using the first method. What I am trying to do is whenever my Python
How do I run a PowerShell script with parameters from Python
I’m trying to run PowerShell scripts that have parameters from Python 3.7.3, but don’t know how to properly call the function in Popen What I’m trying to do with my PowerShell script is login to Cisco routers and run Cisco IOS commands on x number of routers based on how many are defined. So the way I have my PowerShell
Python Subprocess Module | Postgres pg_dump with password
I have a database that I want to back up with my a python code. I tried to base my code from the code in this discussion that uses the subprocess module and pg_dump. My problem now is that I have to manually type in the password to get the backup file. I read somewhere that doing a .pgpass but
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
AWS sync parameters not specified when AWS-CLI is run as a subprocess in Python
I have an AWS S3 bucket filled with data parameterized by date. I’d like to extract that data one date at a time using the AWS CLI (reference), specifically the aws s3 sync command. The following command does what I expect it to do: aws s3 sync s3://my-bucket-1 . –exclude “*” –include “*2018-01-17*” –dryrun Running this command from my command
How do I open a visible excel full size?
I am running a python script on both my laptop and home computer with: This works great, however I cannot seem to find anywhere on how to make this full size Any idea on how I can make it full size through python? I use both Apache OpenOffice and microsoft Excel image Answer You should be able to maximize the
Python running as Windows Service: OSError: [WinError 6] The handle is invalid
I have a Python script, which is running as a Windows Service. The script forks another process with: which causes the following error: Answer Line 1117 in subprocess.py is: which made me suspect that service processes do not have a STDIN associated with them (TBC) This troublesome code can be avoided by supplying a file or null device as the