How to test if Canopy editor is open

青春壹個敷衍的年華 提交于 2020-01-14 02:50:09

问题


Is there a way to test if the Canopy editor is open/running that would work across platforms?

On Mac/Unix, it seems to work to check for canopy.app.main in the output of "ps aux", but that is not possible on most Windows. I found a tasklist command that is similar, but it appears Canopy runs as a generic pythonw program.


回答1:


At present, on all OSes, if Canopy is running, then there will be a text file process.lck in the configuration/preferences directory. The second line of the file is the process ID. If Canopy was forced-stopped, the file will still be present even though Canopy is not running, so you should check that this process ID is still running. These implementation details could change in a future version.



来源:https://stackoverflow.com/questions/26088253/how-to-test-if-canopy-editor-is-open

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!