Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

启动程序后,窗口阻塞,怎么解决? #3

Open
liangxinhui opened this issue Sep 21, 2016 · 3 comments
Open

启动程序后,窗口阻塞,怎么解决? #3

liangxinhui opened this issue Sep 21, 2016 · 3 comments

Comments

@liangxinhui
Copy link

liangxinhui commented Sep 21, 2016

这段代码中:

 def open_session(self,kitty_path,session_name):
        subprocess.call('{} -load "{}"'.format(kitty_path,session_name))

subprocess.call执行后,查询窗口会一直阻塞,直到kitty窗口关闭才会继续执行。

我尝试把subprocess.call改为subprocess.Popen,仍然不行。

请问有没有其他办法解决?

post:

在python中单独执行以下代码,是不会阻塞的:
输出1、2,python程序结束,notepad窗口打开。

import subprocess
print 1
subprocess.Popen(['notepad'])
print 2

如果把这段代码放到open_session的位置,窗口会阻塞。debug的话发现subprocess.Popen会阻塞。

@liangxinhui
Copy link
Author

@qianlifeng

@liangxinhui
Copy link
Author

@happlebao 相关issues Wox 961

there is no non-blocking method for jsonrpc plugin in the current arch design, unless you maintain a separate process manually.

意思是,目前1.3版本的架构不支持异步吗?
unless you maintain a separate process manually怎么理解,能否举个例子。

谢谢!

@liangxinhui
Copy link
Author

liangxinhui commented Sep 22, 2016

尝试将subprocess.Popen封装为独立的exe文件,也没有成功:

subcall.py

import subprocess
if __name__ == '__main__':
    import sys
    subprocess.Popen(sys.argv[1:])

将subcall.py用pyinstaller封装为subcall.exe。

main.py

def open_session(self,kitty_path,session_name):
        subprocess.call(['kitty_plugin_path\\subcall.exe','notepad'])

还是同样的现象,在notepad打开的时候,Wox页面是卡死的。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant