我目前正在使用Python模块Spynner来自动执行一些Web任务.我遇到了一个问题,虽然由于某种原因,该过程只是停止移动,冻结但仍然响应Windows.
我想要做的是设置某种形式的监视器来检查并查看是否发生这种情况,然后重新启动该过程.我在考虑可能监视程序的终端输出,如果它在一定时间后停止推送数据,它会杀死程序并重新启动.
我知道如何杀死程序并再次运行它,只需使用操作系统和子进程,但我不知道如何设置监视终端是否停止在特定时间内发送数据.
不太明白为什么我收到此跟踪错误:
Traceback (most recent call last):
File "S:/Personal Folders/Andy/Python Projects/Salesforce BZ API/Automated Reports.py", line 15, in <module>
parse = br.soup("find('div')")
File "build\bdist.win32\egg\spynner\browser.py", line 409, in _get_soup
return self._html_parser(self.html)
TypeError: 'str' object is not callable
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
from __future__ import division
#from __future__ import unicode_literals
from __future__ import print_function
import spynner
from BeautifulSoup import BeautifulSoup
#Loading up Salesforce
br = spynner.Browser()
#br.debug_level = spynner.DEBUG
br.create_webview()
br.show()
br.set_html_parser("BeautifulSoup")
br.load("https://login.salesforce.com/")
parse = br.soup("find('div')")
print(parse)
br.browse()
br.close()
Run Code Online (Sandbox Code Playgroud)