python


Intercept subprocess pipe between two processes


At the moment I have two processes, with one generating data to be fed into the other, as shown below:
import subprocess
seq = subprocess.Popen(["seq", "5", "-1", "0"], stdout=subprocess.PIPE)
subprocess.Popen(["sort"], stdin=seq.stdout)
I want to intercept the data flowing through the pipe and process it in some way (e.g. recording the highest number) without buffering the entire result of the first process in memory. How might I go about intercepting the data flowing through the pipe? I shouldn't need to modify the data.
Note: this is the minimal possible example I could come up with. In reality the first process could well be extremely long running and generate hundreds of gigabytes of data.

Related Links

Converting Numpy Array Element to String: TypeError: bad operand type for unary +: 'str'
python import error cx_Oracle in macOS Sierra
Select specific rows and cells in text file and put into data frame: python or R
TensorFlow dynamic_rnn regressor: ValueError dimension mismatch
Using converters in Pandas read_hdf similar to read_csv
python3 package path of local file
Viewing other user profile
Python Tkinter, Stop a threading function
Python runtime warning when move unit test to a package
UserWarning on Django website for Raven client
Organise .rst files for sphinx?
Scatter Plot of a Specific Column in Python using matplotlib
How to make difference between email html body and html attachment in python?
Cobb-Douglas maximization in python
Django won't serve some static files
Flask return SUM into Jinja2 list

Categories

HOME
google-apps-script
ember.js
shopify
antivirus
ruby-on-rails-3
jscript
javamail
webdav
ll
java-home
filter
jpanel
wicket
keystore
cortex-a
public-key-encryption
mongodb-query
glpk
uisplitviewcontroller
reduction
linq-to-sql
apple-tv
rworldmap
qsub
tflearn
sumo
visual-c++-2017
geopandas
version-numbering
helper
piecewise
fractals
swiftcharts
recurrence-relation
shibboleth
openshift-enterprise
inkscape
zero
android-download-manager
issue-tracking
html-agility-pack
upsert
bids
startapp
double-buffering
nsjsonserialization
ideone
appstore-approval
sgmlreader
seamless-immutable
maintenance
google-maps-ios
jszip
mercury
date-range
festival
emgu
onresume
keycode
build-process
verbose
cfeclipse
backstop.js
mongoose-populate
slam-algorithm
mix
gitweb
webkit2
spark-cassandra-connector
instruments
com-interop
achievements
gmsmapview
date-format
xmp
jta
hyperthreading
code-readability
retro-computing
fabric-twitter
textkit
paypal-nvp
mogrify
xjc
ffprobe
viper-architecture
adodb
odftoolkit
adcolony
java-collections-api
ember-addon
smartystreets
colt
cppdepend
sgml
factors
help-viewer
java.util.date
loop-invariant
sslexception
xslkey
android-4.0
crocodoc
usn
datarepeater
wcf-web-api
path-manipulation
svn-hooks
carbide
camtasia
winsnmp

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App