Locking a file in Python

后端 未结 13 2379
悲&欢浪女
悲&欢浪女 2020-11-22 03:00

I need to lock a file for writing in Python. It will be accessed from multiple Python processes at once. I have found some solutions online, but most fail for my purposes as

13条回答
  •  抹茶落季
    2020-11-22 03:56

    Coordinating access to a single file at the OS level is fraught with all kinds of issues that you probably don't want to solve.

    Your best bet is have a separate process that coordinates read/write access to that file.

提交回复
热议问题