[twill] error log issue

C. Titus Brown ctb at msu.edu
Wed Oct 1 20:40:12 PDT 2008


On Wed, Oct 01, 2008 at 04:53:49PM -0700, jeremiah wrote:
-> I am logging my output and errors in a particular file for twill.
-> However, when i run the below python code, which hits index.php pages
-> located in several directories it spits the error code to the screen
-> rather than logging to the error log. I've verified that the logs are
-> being created successfully, so this is not the issue.

Hi, Jeremiah, the code below raises an exception, which isn't trapped by
twill.  You would have to do something like this:

	b = twill.get_browser()
	if b.get_code() != 200:
	   print 'Error!'

instead of using the 'code' function, which raises an exception.

--titus

-> Any ideas why this is?
-> 
-> my code:
-> 
-> def check_base_links():
->         print "Checking base links..."
->         time.sleep(1)
->         host="https://" + subdomain + "url.com"
->         urls=['dir1', 'dir2', 'dir3']
->         for x in urls:
->                 link=host + x + "/index.php"
->                 tw.go(link)
->                 tw.code("200")
->                 print "     " + link
-> 
-> error i'm getting:
-> 
-> Traceback (most recent call last):
->   File "dart.py", line 143, in <module>
->     check_base_links()
->   File "dart.py", line 99, in check_base_links
->     tw.code("200")
->   File "/var/lib/python-support/python2.5/twill/commands.py", line 129,
-> in code
->     should_be))
-> twill.errors.TwillAssertionError: code is 404 != 200
-> 
-> 
-> 
-> 
-> Disclaimer: The information contained in this transmission, including any 
-> attachments, may contain confidential information of Panasonic Avionics
-> Corporation.  This transmission is intended only for the use of the 
-> addressee(s) listed above.  Unauthorized review, dissemination or other use 
-> of the information contained in this transmission is strictly prohibited. 
-> If you have received this transmission in error or have reason to believe 
-> you are not authorized to receive it, please notify the sender by return 
-> email and promptly delete the transmission.
-> 
-> 
-> 
-> _______________________________________________
-> twill mailing list
-> twill at lists.idyll.org
-> http://lists.idyll.org/listinfo/twill
-> 

-- 
C. Titus Brown, ctb at msu.edu



More information about the twill mailing list