<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>tako_eng</author_name>
  <author_url>https://blog.hatena.ne.jp/tako_eng/</author_url>
  <blog_title>blog</blog_title>
  <blog_url>https://tako-eng.hatenablog.com/</blog_url>
  <categories>
    <anon>プログラミング(python)</anon>
  </categories>
  <description>pythonで書き込み・読み込み中のファイルにwriteをぶつけるとファイルが壊れる(？)らしい。 DBとか使えば勝手に排他かけてくれるらしいけど、まあpythonだけでやるならどうしましょって話。 ・解 fcntl.flock関数を使う ・参考 公式リファレンス fcntl --- fcntl および ioctl システムコール — Python 3.7.4 ドキュメント ・注意点 ロック獲得に失敗した場合に排出されるエラーが、 2系と3系で違うので注意（IOErrorとOSError）。 下記は2系 #!/usr/bin/python # -*- coding: utf-8 -*- #読み…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftako-eng.hatenablog.com%2Fentry%2F2019%2F09%2F19%2F070800&quot; title=&quot;python2系で排他ロックする方法 - blog&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>2019-09-19 07:08:00</published>
  <title>python2系で排他ロックする方法</title>
  <type>rich</type>
  <url>https://tako-eng.hatenablog.com/entry/2019/09/19/070800</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
