>>821
おれも調べたけど、Pythonではwindowsとunixとで共通に使えるfile lockは提供されてないみたい。
これぐらいあってもおかしくないのにね。Rubyにはあるからできないはずないんだけど。file descriptor関係なく。
おれは
fcntl = msvcrt = None
try:
 import fcntl
except ImportError, ex:
 try:
  import msvcrt
 except ImportError, ex:
  pass
として、あとはfcntl is not Noneならfcntl.flock()を、msvcrt is not Noneならmsvcrt.locking()を呼び出す関数を定義している。
>>827の方法だとうまくいかないと思うけど、うまくいったら教えて。