为什么Python(带twill)不想让我在这里登录到Yahoo邮箱?
谁能给我解释一下这是怎么回事吗。当我试图登录到我在雅虎上的邮箱时,Python似乎拒绝工作(使用twill):为什么Python(带twill)不想让我在这里登录到Yahoo邮箱?,python,login,twill,yahoo-mail,Python,Login,Twill,Yahoo Mail,谁能给我解释一下这是怎么回事吗。当我试图登录到我在雅虎上的邮箱时,Python似乎拒绝工作(使用twill): Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. **************************************
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************
IDLE 1.2.4
>>> import twill
>>> twill.shell.main()
-= Welcome to twill! =-
current page: *empty page*
>> go http://us.yahoo.com
==> at http://us.yahoo.com
current page: http://us.yahoo.com
>> follow Mail
==> at https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
current page: https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
>> showforms
Form name=login_form (#1)
## ## __Name__________________ __Type___ __ID________ __Value__________________
1 .tries hidden (None) 1
2 .src hidden (None) ym
3 .md5 hidden (None)
4 .hash hidden (None)
5 .js hidden (None)
6 .last hidden (None)
7 promo hidden (None)
8 .intl hidden (None) us
9 .bypass hidden (None)
10 .partner hidden (None)
11 .u hidden (None) 68gre5567rq16
12 .v hidden (None) 0
13 .challenge hidden (None) 9wKUoOWDdP5Fho0kPfqPKEhPZBdK
14 .yplus hidden (None)
15 .emailCode hidden (None)
16 pkg hidden (None)
17 stepid hidden (None)
18 .ev hidden (None)
19 hasMsgr hidden (None) 0
20 .chkP hidden (None) Y
21 .done hidden (None) http://mail.yahoo.com
22 .pd hidden (None) ym_ver=0&c=&ivt=&sg=
23 pad hidden pad 6
24 aad hidden aad 6
25 login text username
26 passwd password passwd
27 .persistent checkbox persistent [] of ['y']
28 1 .save submi ... .save
current page: https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
>> fv 1 login *****************
current page: https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
>> fv 1 passwd ***************
current page: https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
>> submit
Note: submit is using submit button: name=".save", value=""
Following HTTP-EQUIV=REFRESH to http://us.mg5.mail.yahoo.com/dc/launch?.gx=1&.rand=b3a02cc8lb0aa
current page: http://us.mg5.mail.yahoo.com/dc/launch?.gx=1&.rand=b3a02cc8lb0aa
>> info
Page information:
URL: http://us.mg5.mail.yahoo.com/dc/launch?.gx=1&.rand=b3a02cc8lb0aa
HTTP code: 200
Content type: text/html; charset=utf-8 (HTML)
Page title: Yahoo! Mail
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
twill.shell.main()
File "C:\Python25\Lib\site-packages\twill\shell.py", line 383, in main
shell.cmdloop(welcome_msg)
File "C:\Python25\lib\cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "C:\Python25\lib\cmd.py", line 219, in onecmd
return func(arg)
File "C:\Python25\Lib\site-packages\twill\shell.py", line 42, in do_cmd
print '\nERROR: %s\n' % (str(e),)
File "C:\Python25\lib\HTMLParser.py", line 59, in __str__
result = self.msg
AttributeError: 'ParseError' object has no attribute 'msg'
>>>
win32上的Python 2.5.4(r254:67916,2008年12月23日,15:10:54)[MSC v.1310 32位(英特尔)]
有关详细信息,请键入“copyright”、“credits”或“license()”。
****************************************************************
个人防火墙软件可能会警告连接空闲
使用此计算机的内部环回对其子进程进行
接口。此连接在任何外部设备上都不可见
接口,不向Internet发送数据或从Internet接收数据。
****************************************************************
怠速1.2.4
>>>进口斜纹布
>>>斜纹布。贝壳。主()
-欢迎来到twill=-
当前页:*空白页*
>>去http://us.yahoo.com
==>在http://us.yahoo.com
当前页面:http://us.yahoo.com
>>跟踪邮件
==>在https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
当前页面:https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
>>展品
表单名称=登录表单(#1)
#####(名称)(名称)(名称)(名称)(名称)(名称)(名称)(名称)(名称)(名称)(名称)名称(名称)(名称)名称__________________
1.尝试隐藏(无)1
2.src隐藏(无)ym
3.md5隐藏(无)
4.哈希隐藏(无)
5.js隐藏(无)
6.上次隐藏(无)
7促销隐藏(无)
8.国际隐藏(无)我们
9.旁路隐藏(无)
10.隐藏合作伙伴(无)
11.u隐藏(无)68gre5567rq16
12.v隐藏(无)0
13.挑战隐藏(无)9WKUOWDDP5FHO0KPFQPKEHPZBDK
14.yplus隐藏(无)
15.电子邮件代码隐藏(无)
16包装隐藏(无)
17隐藏的stepid(无)
18.电动汽车隐藏(无)
19 hasMsgr隐藏(无)0
20.chkP隐藏(无)Y
21.完成隐藏(无)http://mail.yahoo.com
22.pd隐藏(无)ym_ver=0&c=&ivt=&sg=
23焊盘隐藏焊盘6
24 aad隐藏aad 6
25登录文本用户名
26密码passwd密码passwd
27.持续复选框持续[…]
28.1.保存Subm。拯救
当前页面:https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
>>FV1登录*****************
当前页面:https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
>>fv 1 passwd***************
当前页面:https://login.yahoo.com/config/login_verify2?.intl=us&.src=ym
>>提交
注意:提交使用提交按钮:name=“.save”,value=“”
以下HTTP-EQUIV=刷新到http://us.mg5.mail.yahoo.com/dc/launch?.gx=1&.rand=b3a02cc8lb0aa
当前页面:http://us.mg5.mail.yahoo.com/dc/launch?.gx=1&.rand=b3a02cc8lb0aa
>>信息
页面信息:
网址:http://us.mg5.mail.yahoo.com/dc/launch?.gx=1&.rand=b3a02cc8lb0aa
HTTP代码:200
内容类型:text/html;字符集=utf-8(HTML)
页面标题:雅虎!邮寄
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
斜纹布。贝壳。主()
文件“C:\Python25\Lib\site packages\twill\shell.py”,第383行,在main中
shell.cmdloop(欢迎使用消息)
cmdloop中第142行的文件“C:\Python25\lib\cmd.py”
停止=self.onecmd(行)
onecmd中的文件“C:\Python25\lib\cmd.py”,第219行
返回函数(参数)
文件“C:\Python25\Lib\site packages\twill\shell.py”,第42行,在do\u cmd中
打印“\n错误:%s\n%”(str(e),)
文件“C:\Python25\lib\HTMLParser.py”,第59行,在__
结果=self.msg
AttributeError:“ParseError”对象没有属性“msg”
>>>
更新1: (此更新是我对Robus的回答) 你好,罗布斯 首先,我认为你写的是一个打字错误:
这就是我所做的:去 C:\Python26\Lib\site packages\twill-0.9-py2.6.egg\twill\other\u包\
我想你的意思是:“C:\Python26\Lib\site packages\twill\other_packages”。否则,我在那里看不到任何名为“twill-0.9-py2.6.egg”的文件夹/目录-只有一个同名文件(我认为是在安装mechanize时下载的文件)。请告诉我,如果我的假设是错误的-我可能在这里看不到非常明显的东西,因为我只是一个新手 所以,按照你的指示,我做到了:
IDLE 1.2.4
>>> import twill
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import twill
File "C:\Python25\Lib\site-packages\twill\__init__.py", line 52, in <module>
from shell import TwillCommandLoop
File "C:\Python25\Lib\site-packages\twill\shell.py", line 9, in <module>
from twill import commands, parse, __version__
File "C:\Python25\Lib\site-packages\twill\commands.py", line 7, in <module>
import _mechanize_dist as mechanize
ImportError: No module named _mechanize_dist
su
git clone git://github.com/jjlee/mechanize.git
cd mechanize
python setup.py install