How can i start using twill?

Sorry, I already asked this question to "Superuser", but no one answers there, so I deleted it from "Superuser" and decided to publish it here. I hope this is not a big crime, especially considering the fact that I was first advised to use the twill here in "StackOverflow" (and not in "SuperUser")

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

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

The twill documentation section says:


Twill loading

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

Twill works with Python 2.3 or later.

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

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


From this passage it is not clear to me what I should type (only “twill-sh” or “twill-sh” and all the words on this line) and where (I tried to type it in the command line of my computer - but to no avail)

Can someone please help me here?

Thanks in advance.


Update 1:

(This update is a response to S. Mark's answer)

Hi S.Mark !!!! I tried to follow your instructions. Here's what happened:

First, I created a folder on my D-drive and named it "tmp". Then I downloaded and unpacked twill-0.9 into this folder. So, now the path to this file on my computer was the same as in your example: D: \ tmp \ twill-0.9: alt text
(source: narod.ru )

alt text
(source: narod.ru )

Then I tried to open a command prompt on my computer: alt text
(source: narod.ru )

alt text
(source: narod.ru )

alt text
(source: narod.ru )

alt text
(source: narod.ru )

alt text
(source: narod.ru )

Then, following step 2 of your instructions, I tried to go to drive D:

alt text
(source: narod.ru )

But for some reason this did not work:

alt text
(source: narod.ru )

This Chinese line says something like: "This action was rejected." Why is this so? Well, I still tried to go to step 3, and here is what I got:

alt text
(source: narod.ru )

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


Update 2:

(This update is my second answer to S. Mark's answer)

Hi S.Mark !!! Thanks for your reply again.

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

But then, when I typed "python setup.py build", I got the same error message ("python is neither an internal nor an external command; it cannot be executed"): alt text
(source: narod.ru )

I tried to repeat this command and accidentally missed the word "python":
alt text
(source: narod.ru )

When I pressed the Enter key, the build process seemed to start - at least what I saw was very similar to step 4 of your instructions (“run the build process”): alt text
(source: narod.ru )
alt text
(source: narod.ru )
alt text
(source: narod.ru )

But now I have a little doubt in going to step 5 (“Install it”), as I’m not sure that what I did is right.

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

Additional question: how did you manage to put the contents of the terminal in your post without taking screenshots? There seems to be some way to put the contents of the terminal on the clipboard? Taking screenshots all the time and posting them before publication is rather cumbersome.


Update 3:

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

S.Mark, hello again !!!

(I hope you're not tired of me yet)

"... And yes, you can omit python and run setup.py directly, because your python installation registered * .py in the registry ... as for step 5, you can just run setup.py install" - I followed your words, and The installation process was successful! Thank you.

But as for the following steps ("then open the Python prompt from the Start menu and check steps 6 and 8"), the Python prompt didn't have much success: alt text
(source: narod.ru )

Also, this was not successful on a regular command line (terminal): alt text
(source: narod.ru )

(The Chinese language again says that python “is neither an internal nor an external command and therefore cannot be executed”). Do you have any idea why this didn't work?

"... Where is your python installation? C: \ Python25?" - Yes, that's right.

"... There is a setting (command line properties - simple editing mode) to enable the selection of text on the command line, you can ask about it on superuser.com?" - Of course, I will ask this question there. Thanks for telling me.

+4
python installation twill
source share
1 answer

You cannot just double-click setup.py

You need to open a command line or shell and go to this folder

and need to do

 python setup.py build python setup.py install 

the installation step should automatically build normally, so only the last one will work


Edit : ok, here is a way to install superuser.

  • I extracted twill-0.9.tar.gz in D: \ tmp \ twill-0.9

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

      C: \> d: 
  • Now change the folder using the 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 it 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
     >>> 
  • The import was fine, but on python 2.6 there is DeprecationWarnings, but this should be fine and there should be no warnings at all with python 2.5

  • confirm that it is correctly 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
     >>> 
+10
source share

All Articles