我有一些代码 n openshfift 正在使用 python 程序的斜纹模块,所以我安装了斜纹但我不能通过 ssh 模式运行一个简单的斜纹命令代码是:
import twill, os
#os.environ['http_proxy']='http://222.66.115.233:80'
t_com = twill.commands
## get the default browser
t_brw = t_com.get_browser()
## open the url
url = 'http://ieeexplore.ieee.org/xpl/articleDetails'
t_brw.go(url)
html = t_brw.result.page
print html
错误是(AttributeError:'ResultWrapper'对象没有属性'page'):
>>> import twill, os
os.environ['http_proxy']='http://222.66.115.233:80'
t_com = twill.commands
## get the default browser
t_brw = t_com.get_browser()
## open the url
url = 'http://ieeexplore.ieee.org/xpl/articleDetails'
url= 'www.google.com'
t_brw.go(url)
html = t_brw.result.page
print html
>>> #os.environ['http_proxy']='http://222.66.115.233:80'
... t_com = twill.commands
>>>
>>> ## get the default browser
... t_brw = t_com.get_browser()
>>> ## open the url
>>> url= 'www.google.com'
>>> t_brw.go(url)
==> at http://www.google.com/
>>> html = t_brw.result.page
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'ResultWrapper' object has no attribute 'page'
>>> print html
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'html' is not defined
>>>
那么有没有人知道如何解决这个问题?