homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients belopolsky, christian.heimes, eric.araujo, flox, georg.brandl, tim.peters, vstinner
Date 2011年07月07日.10:50:00
SpamBayes Score 0.00095128187
Marked as misclassified No
Message-id <1310035801.78.0.438007040732.issue10117@psf.upfronthosting.co.za>
In-reply-to
Content
> Leaving open to discuss whether anything can/should be done
> for the case when reindent acts as an stdin
sys.stdin.buffer and sys.stdout.buffer should be used with tokenize.detect_encoding(). We may read first stdin and write it into a BytesIO object to be able to rewind after detect_encoding. Something like:
content = sys.stdin.buffer.read()
raw = io.BytesIO(content)
buffer = io.BufferedReader(raw)
encoding, _ = detect_encoding(buffer.readline)
buffer.seek(0)
text = TextIOWrapper(buffer, encoding)
# use text
History
Date User Action Args
2011年07月07日 10:50:01vstinnersetrecipients: + vstinner, tim.peters, georg.brandl, belopolsky, christian.heimes, eric.araujo, flox
2011年07月07日 10:50:01vstinnersetmessageid: <1310035801.78.0.438007040732.issue10117@psf.upfronthosting.co.za>
2011年07月07日 10:50:01vstinnerlinkissue10117 messages
2011年07月07日 10:50:00vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /