The problem is that I cannot record the output of my Python script using Tee-Object
to both terminal and a file.
I have multiple files containing lines of data. I need to verify this data via an HTTP request to a server. There are 8 large files and given I expect this will take a day to run since I don't want to flood the server.
Importing file strings and running Python script is producing output to terminal. Completed as follows:
$db = Import-Csv C:\Users\xxxx\documents\bunnies\foo.txt foreach ($i in $db.StringName) { & py -2.7 myscript.py -option $i }
$db
is the file.$i
is the string (line) in the file. script prints to terminal.Since the output is going to be over several days, I need to know that it will be recorded.
Tee-Object
has not created a file after an hour of output.foreach ($i in $db.StringName) { & py -2.7 myscript.py -option $i } > Tee-Object -FilePath .../bunnyrabbit.txt
I assume that
> Tee-Object -FilePath .../bunnyrabbit.txt
appended should create the file immediately and write in an ongoing manner?I need to be able to check the output is okay as the program runs.
Additional: filtering output
The output per line of the script is simply "x is correct" or "x is incorrect". If I want to filter all the corrects into one file and the incorrects into another how to go about this?
My original plan was simply to re-read the output file in python and do it in a language I know.