任何人都可以,请向我解释什么在这里。它似乎是蟒蛇拒绝工作(斜纹)当我试图登录到我的邮箱上Yahoo:

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'
>>> 

1更新:

(更新这是我的回答Robus)

你好,Robus!!!

首先,我假设它是一个打字错误时写道:


这是我做了什么:去 C:\Python26\Lib\网站-包\斜纹的-0.9-py2.6.卵\斜纹\other_packages\


我认为你的意思是这的路径:"C:\Python26\Lib\site-packages will\other_packages".否则,我看不到任何这种文件夹/目录还有名为"斜纹的-0.9-py2.6.蛋"-只有一个文件,这个名称(在一个我认为是下载的在安装的机械化.) 请告诉我,如果我的假设是错误的-我很可能是看不到的东西很明显在这里因为我只是个新手。

因此,按照你的指示,我这样做:

  1. 我发现了"C:\Python25\Lib\site-packages will\other_packages_mechanize_dist"我的电脑上(如你可以看到,我没有python26,而是蟒蛇25安装了-那也可能是一个问题)

  2. 其名称改为"_mechanize_dist_backup"(完整的路径现在"C:\Python25\Lib\site-packages will\other_packages_mechanize_dist_backup")

  3. 复制我的下载和打开"机械化-0.2.2"进入"C:\Python25\Lib\site-packages will\other_packages"(全道路"C:\Python25\Lib\site-packages will\other_packages\mechanize-0.2.2")

  4. 其名称改为"_mechanize_dist"(全道路"C:\Python25\Lib\site-packages will\other_packages_mechanize_dist")

  5. 复制"ClientForm"文件"_mechanize_dist_backup"并将其粘贴在"_mechanize_dist"(事实上,我找到两个文件命名为"ClientForm":一个是一条巨蟒文件,另一个是编制python文件-我抄和粘贴这两个)。

具有这样做,我尝试运行所有这些命令,并得到了坚持在开始-我甚至不能进口斜纹现在:


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

看来,该系统不承认新建的"_mechanize_dist".

这可能是因为我有Python25,而不是蟒蛇26?或者,也许,有一些其他的原因吗?

有帮助吗?

解决方案

问题在于在机械化.你需要的最新版本

su
git clone git://github.com/jjlee/mechanize.git
cd mechanize
python setup.py install
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top