2016-04-08 145 views
0

所以这是一个基本的客户端服务器套接字程序。客户端将文件发送到服务器,服务器使用gedit打开它。如何检查文本文件是否在gedit中打开

p = subprocess.Popen("gedit file", shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT) 

我想要的代码像

while file_open in gedit: 
      wait() 
after file_closed and saved 
      send to client 
+0

可能重复的[Python:检查文件被锁定](http://stackoverflow.com/questions/13371444/python-check-file-is-locked) – CarlosCarucce

回答

0
while p.is_alive(): 
    ... 

我猜的工作......但真的会只保留只要去的过程中(gedit中)打开......他们可能已关闭该特定文件...