我如何开始使用斜纹呢? [英] How can I start using twill?

查看:126
本文介绍了我如何开始使用斜纹呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,我已经在超级用户"中提出了这个问题,但是没有人在那里回答,因此我从超级用户"中删除了该问题,并决定将其发布在此处.希望这不是大罪,特别是考虑到我首先被建议在"StackOverflow"(而非"SuperUser")上使用斜纹纸

I am sorry I have already asked this question on "Superuser", but nobody answers there, so I deleted it from "Superuser" and decided to post it here. Hope it's not a big crime, especially given the fact that I was firstly advised to use twill here on "StackOverflow" (not on "SuperUser")

如何开始使用斜纹呢?我刚刚下载了它,将其解压缩并单击文件夹中的setup .py文件.黑色的窗口(终端)出现了片刻并消失了.

How do I start using twill? I have just downloaded it, unpacked it and clicked on the setup .py file in the folder. The black window (terminal) appeared for a moment and vanished.

(我的计算机上确实安装了Python 2.5-以及Google App Engine的SDK)

(I do have Python 2.5 installed on my computer - along with SDK from Google App Engine)

在斜纹里文档部分

In the twill documentation section it says:

下载斜纹纸

Downloading twill

斜纹的最新版本是斜纹 0.9,于2007年12月27日,星期四发布;可以从以下位置下载 http://darcs.idyll.org/~t/projects/twill-0.9.tar.gz . 您还可以使用Python的easy_install 安装或升级斜纹布.

The latest release of twill is twill 0.9, released Thursday, December 27th, 2007; it is available for download at http://darcs.idyll.org/~t/projects/twill-0.9.tar.gz. You can also use Python's easy_install to install or upgrade twill.

斜纹可在Python 2.3或更高版本上使用.

twill works with Python 2.3 or later.

要开始使用斜纹布,请安装并 然后键入twill-sh.在提示时 类型:

To start using twill, install it and then type twill-sh. At the prompt type:

go http://www.slashdot.org/
show
showforms
showhistory

go http://www.slashdot.org/
show
showforms
showhistory


从这段文字中我不清楚我应该键入什么(只有"twill-sh"或"twill-sh"以及该行下的所有单词)以及在哪里(我尝试在命令提示符窗口中键入它)我的电脑-无济于事


I am not clear from this passage what I am supposed to type (only "twill-sh" or "twill-sh" and all the words under that line) and where (I tried typing it in the command prompt window of my computer - to no avail)

任何人都可以在这里帮助我吗?

Can, anyone, please, help me out here?

先谢谢您.

更新1:

(此更新是对S.Mark给出的答案的回应)

(This update is a response to the answer given by S.Mark)

你好,S.Mark !!! 我已尝试按照您的指示进行.这是发生了什么:

Hello, S.Mark!!!! I’ve tried to follow Your instructions. Here is what happened:

首先,我在D盘上创建了一个文件夹,并将其命名为"tmp".然后我下载了twill-0.9并将其解压缩到该文件夹​​中.因此,现在我计算机上该文件的路径与您的示例中的路径相同:D:\ tmp \ twill-0.9:
(来源: narod.ru )

Firstly, I created a folder on my D disk and named it "tmp". Then I downloaded and extracted twill-0.9 into that folder. So, now the path to this file on my computer was just as same as the one in Your example: D:\tmp\twill-0.9 :
(source: narod.ru)


(来源: narod.ru )


(source: narod.ru)

然后,我尝试在计算机上打开命令提示符:
(来源: narod.ru )

Then, I tried to open the command prompt on my computer:
(source: narod.ru)


(来源: narod.ru )


(source: narod.ru)


(来源: narod.ru )


(source: narod.ru)


(来源: narod.ru )


(source: narod.ru)


(来源: narod.ru )


(source: narod.ru)

然后,按照您的说明的步骤2,我尝试切换到D盘:

Then, following step 2 of Your instructions, I tried to switch to D disk:


(来源: narod.ru )


(source: narod.ru)

但是由于某种原因,它不起作用:

But for some reason it didn’t work:


(来源: narod.ru )


(source: narod.ru)

该中文行显示类似此操作已被拒绝"的字样.为什么会这样呢? 好吧,无论如何,我还是尝试着进行第3步,这就是我得到的:

This Chinese line says something like "This action has been rejected." Why is it so? Well, I tried to proceed to step 3 anyway, and here is what I’ve got:


(来源: narod.ru )


(source: narod.ru)

据我了解,此中文行说‘C:\’既不是内部命令也不是外部命令,因此无法执行. " 为什么会这样呢?我的电脑出问题了吗?

As far as I can understand, this Chinese line says something like " ’C:\’ is neither internal nor external command, thus, it cannot be carried out. " Why is it so? Is there something wrong with my computer?

更新2:

(此更新是我对S.Mark给出的答案的第二个答复)

(This update is my second response to the answer given by S.Mark)

您好,S.Mark !!!再次感谢您的回答.

Hello, S.Mark!!! Thank You for Your answer again.

是的,这次是有效的,当我只是键入您在帖子中突出显示的那些部分时.因此,当我一开始只输入"d:"时,它就可以了!!!

Yes, this time it worked when I just typed those parts that You highlighted in Your post. So, when I typed just "d:" in the very beginning, it worked!!!

但是,当我键入"python setup.py build"时,我得到了相同的错误消息(‘python’既不是内部命令也不是外部命令;它不能执行."):
(来源: narod.ru )

But then, when I typed "python setup.py build", I got the same error message (" ’python’is neither an internal or external command; it can’t be carried out. ") :
(source: narod.ru)

我试图重复此命令,但无意中省略了"python"一词:

(来源: narod.ru )

I tried to repeat this command and accidentally omitted the word "python":

(source: narod.ru)

当我按Enter键时,构建过程似乎开始了-至少我所看到的类似于您的说明的第4步(启动构建过程"):
(来源: narod.ru )

(来源: narod.ru )

(来源: narod.ru )

When I pressed "Enter" key, the build process seemed to launch - at least what I saw then resembled the step 4 of Your instructions ("start the build process") very much:
(source: narod.ru)

(source: narod.ru)

(source: narod.ru)

但是现在我对继续执行步骤5(安装它")有些犹豫,因为我不确定我所做的事情是否正确.

But now I am a little bit hesitant about proceeding to step 5 ("Install It") as I am not sure if what I have done is the right thing.

如果我在第4步中所做的一切还可以,我也应该在第5步中省略"python"一词吗?

If what I did in step 4 was okay, should I also omit the word "python" in step 5?

另一个问题:您如何在不制作屏幕截图的情况下将终端的内容放入您的帖子中?就像有某种方法可以将终端的内容放入剪贴板吗?始终制作屏幕截图并在发布之前托管它们非常麻烦.

A side question: How did You manage to put the contents of the terminal into Your post without making screenshots? Is it like there is some way of putting the terminal’s contents into the clipboard? Making screenshots all the time and hosting them prior to posting is quite cumbersome.

更新3:

(此更新是我对S.Mark的第三次回复)

(This update is my third response to S.Mark)

S.Mark,您好!!!

S.Mark, hello again!!!

(希望您还不厌倦我)

…是的,您可以省略python并直接运行setup.py,因为您的python安装在注册表中注册了* .py……关于第5步,您可以只运行setup.py install" –我按照Yours的这些话安装程序运行成功!谢谢.

"…and yeah you could omit python and directly run setup.py because your python installation registered *.py in registry… regarding step 5, you could just run setup.py install" – I followed these words of Yours and install process ran successfully! Thank You.

但是对于以下步骤(然后从开始菜单中打开python提示符,并测试步骤6和8"),Python提示符并没有太大的成功:
(来源: narod.ru )

But as for the following steps ("then open python prompt from start menu, and test step 6 and 8"), there wasn’t much success in the Python prompt:
(source: narod.ru)

在通常的命令提示符(终端)中都没有成功:
(来源: narod.ru )

Neither was it successful in the usual command prompt (terminal):
(source: narod.ru)

(它再次用中文说python既不是内部命令也不是外部命令,因此不能执行").您知道为什么它不起作用吗?

(It again says in Chinese that python "is neither an internal nor external command and, therefore, can’t be carried out"). Do You have any idea why it didn’t work?

"...您的python安装在哪里? C:\ Python25?" -是的,没错.

"…where is your python installation? C:\Python25?" - Yes, that’s right.

……有一个设置(命令提示符属性-简易编辑模式)可以在命令提示符下选择文本,您能在superuser.com上问一下吗?" -当然,我会在那儿问这个问题.谢谢你告诉我.

"…there is a setting (command prompt properties - easy edit mode) to enable selection of text on the command prompt, could you ask that in superuser.com?" - Sure, I will ask this question there. Thanks for telling me.

推荐答案

您不能只双击setup.py

You cannot just double click setup.py

您需要打开命令提示符或shell并转到该文件夹​​

You need to open command prompt or shell and go to that folder

并且需要做

python setup.py build
python setup.py install

安装步骤应该会自动正常构建,因此只有最后一个可以工作

install step should automatically do build normally, so only last one will work

编辑:确定,这是超级用户的安装步骤方式

Edit: ok, here is superuser way of installation steps

  1. 我已将twill-0.9.tar.gz提取到D:\ tmp \ twill-0.9

  1. I have extracted twill-0.9.tar.gz to D:\tmp\twill-0.9

我在驱动器C上,所以我切换到了D:

I am on drive C, so I switched to D:

C:\>d:

  • 现在,使用cd命令更改文件夹

  • Now, change the folder by using cd command

    C:\>cd D:\tmp\twill-0.9

  • 开始构建过程

  • start the build process

    D:\tmp\twill-0.9>python setup.py build
    (WARNING: importing distutils, not setuptools!)
    D:\data\program\Python26\lib\distutils\dist.py:266: UserWarning: Unknown distribution option: 'entry_points'
      warnings.warn(msg)
    D:\data\program\Python26\lib\distutils\dist.py:266: UserWarning: Unknown distribution option: 'test_suite'
      warnings.warn(msg)
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\twill
    ......
    running build_scripts
    creating build\scripts-2.6
    copying and adjusting twill-fork -> build\scripts-2.6

  • 安装

  • Install it

    D:\tmp\twill-0.9>python setup.py install
    (WARNING: importing distutils, not setuptools!)
    running install
    running build
    running build_py
    ......
    running install_scripts
    copying build\scripts-2.6\twill-fork -> D:\data\program\Python26\Scripts
    running install_egg_info
    Writing D:\data\program\Python26\Lib\site-packages\twill-0.9-py2.6.egg-info

  • 是否测试导入

  • Test for import is or not

    D:\tmp\twill-0.9>python
    Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.  
    >>> import twill
      import re, base64, urlparse, posixpath, md5, sha, sys, copy
    twill\other_packages\_mechanize_dist\_auth.py:14: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
      import re, base64, urlparse, posixpath, md5, sha, sys, copy
    >>>

  • 导入很好,但是python 2.6上有DeprecationWarnings,但这应该可以,并且在python 2.5上应该完全没有警告

  • Import was fine, but there is DeprecationWarnings on python 2.6, but this should be ok and should be no warnings at all with python 2.5

    确认是否正确导入了斜纹,您将在其中看到斜纹及其功能,所以是.

    confirm its properly imported or not, you will see twill and its functions there, so yes.

    >>> dir()
    ['__builtins__', '__doc__', '__name__', '__package__', 'twill']
    >>> from twill.commands import *
    >>> dir()
    ['__builtins__', '__doc__', '__name__', '__package__', 'add_auth', 'add_extra_header', 'agent', 'back', 'clear_cookies', 'clear_extra_headers', 'code', 'config', 'debug', 'echo', 'exit', 'extend_with', 'fa', 'find', 'follow
    >>>

  • 这篇关于我如何开始使用斜纹呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆