scripting

Running multiple Python scripts simultaneously and then sequentially

跟風遠走 提交于 2020-08-21 19:39:13
问题 I can run multiple Python scripts simultaneously from a bash script like this; #!/bin/bash python pr1.py & python pr2.py & python aop.py & python loader.py & But what if I want a batch to fire simultaneously and after they've run, start some more sequentially. Will this work?: #!/bin/bash python pr1.py & python pr2.py & python ap.py & python loader.py python cain.py python able.py 回答1: On your bash script you can simply add the wait command like this: #!/bin/bash python pr1.py & python pr2.py

Running multiple Python scripts simultaneously and then sequentially

白昼怎懂夜的黑 提交于 2020-08-21 19:35:42
问题 I can run multiple Python scripts simultaneously from a bash script like this; #!/bin/bash python pr1.py & python pr2.py & python aop.py & python loader.py & But what if I want a batch to fire simultaneously and after they've run, start some more sequentially. Will this work?: #!/bin/bash python pr1.py & python pr2.py & python ap.py & python loader.py python cain.py python able.py 回答1: On your bash script you can simply add the wait command like this: #!/bin/bash python pr1.py & python pr2.py

Read Bash variables into a Python script

a 夏天 提交于 2020-08-20 23:09:11
问题 I am running a bash script (test.sh) and it loads in environment variables (from env.sh). That works fine, but I am trying to see python can just load in the variables already in the bash script. Yes I know it would probably be easier to just pass in the specific variables I need as arguments, but I was curious if it was possible to get the bash variables. test.sh #!/bin/bash source env.sh echo $test1 python pythontest.py env.sh #!/bin/bash test1="hello" pythontest.py ? print test1 (that is

Add new key value pair to JSON file in powershell.

一笑奈何 提交于 2020-07-20 08:35:33
问题 I have an existing JSON file with the following: { "buildDate": "2017-08-16", "version": "v1.2.0" } How do you add new key-value pairs to an existing JSON file? For example, I would like to take the above JSON, and end up with this: { "buildDate": "2017-08-16", "version": "v1.2.0", "newKey1": "newValue1", "newKey2": "newValue2" } I currently write to JSON with the following code: @{buildDate="2017-08-16"; version="v1.2.0"} | ConvertTo-Json | Out-File .\data.json 回答1: Convert the JSON data to

Equivalent to bash “expect” in powershell

半世苍凉 提交于 2020-07-18 10:42:19
问题 I'm using powershell to run another powershell script, at some point the other script asks for some input, I would like to be able to read the output from the other script and based on that supply input to it. Similar to what you can do with expect on bash. Any ideas? Thanks 回答1: Just posting my solution so that it can help someone. I faced the same problem while running some other script that will ask for answers. First create a file "inputFileLocation.txt" with answers to each question in

Declaring early bound MSXML object throws an error in VBA

点点圈 提交于 2020-07-17 09:25:53
问题 I am trying to import xml data into excel.. So the first line of the code is Dim XMLDOC As MSXML2.DOMDocument and this gives an error "user defined type not defined" 回答1: Inside the VBE, Go to Tools -> References, then Select Microsoft XML, v6.0 (or whatever your latest is. This will give you access to the XML Object Library. Updated with fancy pic! 回答2: I had DOMDocument defined which needed Microsoft XML, v3.0 but I had Microsoft XML, v6.0 selected in references which caused the below error