[twill] Problem with file upload using formfile

Titus Brown titus at caltech.edu
Sat Jul 8 18:04:35 PDT 2006

-> The file upload works fine for both IE and Firefox so i guess this is not 
-> browser related issue.
-> I am presently doing regression automation using Twill and needs to 
-> complete it ASAP. As I am required to get this issue (uploading of file 
-> using formfile command in the Twill script) resolved at urgent basis, could 
-> you please direct me as to what needs to be done ( like change the source 
-> code to fix this issue). In this way I can contribute to Twill and get the 
-> issue of uploading file using twill script resolved for me as well.
-> Could you please let me know your views on the above ASAP.

hi, Swati, let me elaborate on my previous post.

If you would like to help fix twill so that your formfile upload works,
then I need to figure out *exactly* what the problem is.  In particular,
it's necessary to figure out how the twill/mechanize file upload is
different from the IE/Mozilla file upload.

If you do the following, it will let me figure out precisely what the
difference is.

1. Download and unpack scotch:


   (conveniently the scotch documentation doesn't tell you where to
    get the source code.  Oops, I'll fix that...)

2. Run the scotch recording proxy, to record the twill traffic:

   cd scotch-latest
   bin/run-recording-proxy twill-traffic.pickle

3. Set the http_proxy environment variable for twill:

       export http_proxy='http://localhost:8000'

4. Run your twill script(s) to do the file upload.

5. kill the recording proxy (CTRL-C will exit it & save the results)

6. Start a new recording proxy to record your browser traffic:

   bin/run-recording-proxy browser-traffic.pickle

7. Change your browser proxy settings to use localhost, port 8000.

8. Do the file upload through your browser.

9. Exit the recording proxy.

Once you've done this, you can send me the entire pickles.  (If you
have sensitive Internet accessible hosts etc. and you don't want
to give me the passwords, let me know; I can show you how to extract
just the request/response that you care about.)  At this point I'll
know exactly what is different about the request and response, and
I can either fix it myself in twill or mechanize or go bug the mechanize

I should be able to get to this pretty quickly, so let me know if/when
you'll be able to record the traffic.


More information about the twill mailing list