<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>drafear</author_name>
  <author_url>https://blog.hatena.ne.jp/drafear/</author_url>
  <blog_title>drafear’s diary</blog_title>
  <blog_url>https://drafear.hateblo.jp/</blog_url>
  <categories>
    <anon>python3</anon>
    <anon>cgi</anon>
  </categories>
  <description>python3でcgiを書いていて、画像データを標準出力に出力しようとしてハマったのでメモ 結論 1. sys.stdout.buffer.write を使う 2. 先に print を使っていたなら sys.stdout.buffer.write の直前に sys.stdout.flush を呼ぶ サンプルコード print(&quot;Content-Type: image/png&quot;) print(&quot;Content-Disposition: attachment; filename=hoge.png&quot;) print(&quot;&quot;) sys.stdout.flush() # printとwriteの間に呼ぶ …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdrafear.hateblo.jp%2Fentry%2F2017%2F10%2F19%2F155347&quot; title=&quot;python3でバイナリデータを標準出力に出力する - drafear’s diary&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-10-19 15:53:47</published>
  <title>python3でバイナリデータを標準出力に出力する</title>
  <type>rich</type>
  <url>https://drafear.hateblo.jp/entry/2017/10/19/155347</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
