How can I start using twill?
Asked Answered
B

1

4

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")

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.

(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

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.

twill works with Python 2.3 or later.

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

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


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?

Thank You in advance.


Update 1:

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

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

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 : alt text
(source: narod.ru)

alt text
(source: narod.ru)

Then, I tried to open the 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 switch to D disk:

alt text
(source: narod.ru)

But for some reason it didn’t work:

alt text
(source: narod.ru)

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:

alt text
(source: narod.ru)

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?


Update 2:

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

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

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

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. “) : alt text
(source: narod.ru)

I tried to repeat this command and accidentally omitted the word “python”:
alt text
(source: 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: alt text
(source: narod.ru)
alt text
(source: narod.ru)
alt text
(source: narod.ru)

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.

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.


Update 3:

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

S.Mark, hello again!!!

(Hope you are not sick and tired of me yet)

“…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.

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: alt text
(source: narod.ru)

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

(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?

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

“…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.

Banting answered 16/4, 2010 at 7:33 Comment(6)
ah, you don't need to type C:\> thats is my prompt like C:\Documents and Settings\Administrator> in yours, just type D:, etc.. I am going to update my post to highlight those parts.Monikamoniker
@brilliant, for your second update, its becuause of python.exe not on your path, where is your python installation? C:\Python25? if so, type set PATH=C:\Python25;%PATH% and <enter> before you type python setup.py build, and yeah you could omit python and directly run setup.py because your python installation registered *.py in registry.Monikamoniker
regarding copying terminal texts, 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?Monikamoniker
regarding step 5, you could just run setup.py install, then open python prompt from start menu, and test step 6 and 8Monikamoniker
regarding this screen shot, there is no error on import twill, so its apparently mean install was successful, you getting syntax error because you running D:\tmp\twill-0.9 which was prompt, you dont need to type anywhere. and python is program, so you couldn't call python inside python shell, so >>> python is invalid.Monikamoniker
regarding last screen shot, right click my computer -> properties -> advanced, environment variable , then find "Path", and edit it , add C:\Python25;, after that open new command prompt, you would able to run pythonMonikamoniker
M
10

You cannot just double click setup.py

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

and need to do

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. I have extracted twill-0.9.tar.gz to D:\tmp\twill-0.9

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

    C:\>d:
  3. Now, change the folder by using cd command

    C:\>cd D:\tmp\twill-0.9
  4. 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
  5. 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
  6. 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
    >>>
  7. 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

  8. 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
    >>>
Monikamoniker answered 16/4, 2010 at 7:44 Comment(15)
"...and go to that folder" - S.Mark, do You mean I need to type the whole path there?Banting
If you don't want to type, you could copy path from address bar from folder window, paste it to command prompt, after you typing cd (change directory)Monikamoniker
ok, I am going to add superuser way of installation steps. hold on for a whileMonikamoniker
@ S.Mark: WOW!!! S.Mark, thank You SOOOOOO MUCH for this expanded answer. I am studying Your instructions at the moment in order to follow them. If I don't come back one of these days, then it means everything was successful. Sorry for the late response. Thanks again!Banting
@brilliant, btw, did you click upvote button 2 times ? :P just wondering, no problem through.Monikamoniker
I don't know what happened. After I read Your edit and responded to it, I immediately clicked the "up-vote" button and I must've done it more than once. Then I clicked on "set-your-answer-as-accepted" check to make it green. I don't remember how many points the "up-vote" indicator showed before or after I clicked on it. Right now it shows "3" and no matter how many times I am trying to make it higher, it keeps returning from "4" to "3" telling me that the "vote is too old to be changed unless the answer is edited".Banting
@brillient, :D those are one time votes, when you click again, thats revoke the votes, I'll edit it again, but anyway, it does not matter.Monikamoniker
@ S.Mark: Okay, I just clicked on it (only once), so now it's "4". Thank You one more time.Banting
@ S.Mark: Hello, S.Mark!!!! I am sorry to bother You again. I've tried to apply all of Your steps and seem to have gotten stuck in the very beginning. I am afraid something is wrong with my computer. Please, if You still have time and desire, check out the "Update 1" section in the main body of my question. Thank You.Banting
@ S.Mark: Hello, S.Mark! Thank You for the new edits. Yes, it works now when I just type the parts You have highlighted, but the build process didn't go at first, and later, thanks/due to one mistake that I made, it started and finished, but now I am kind of puzzled why. Please, refer to the "Update 2" section in my question above for details. Thank You.Banting
@brilliant, yeah, I've noticed that, I have commented on your questions about that.Monikamoniker
@ S.Mark: Hello, S. Mark. The install process was okay. Everything else still needs some help. Please, refer to the "Update 3". Thank You for Your patience.Banting
@ S.Mark: Hello, S.Mark!!!!! "regarding last screen shot, right click my computer ->...you would able to run python" - Yes,I just followed all these steps and now I can see in the terminal just the same lines as in Python prompt, which means editing (of the "Path" variable) was successful!!!!Banting
@ S.Mark: "there is no error on import twill, so its apparently mean install was successful..." - So, what You are basically saying is that finally twill has been installed on my computer, and now I can run it (both from the Python prompt and from the terminal)!!! Thank You, S.Mark, VERY VERY MUCH!!! Thank You for all these helpful pictures (on how to edit the variable) and a lot of thanks for bearing with me for so long!Banting
Glad to know that brilliant :-)Monikamoniker

© 2022 - 2024 — McMap. All rights reserved.