[twill] error log issue
jeremiah
jeremiah.jester at panasonic.aero
Thu Oct 2 09:22:00 PDT 2008
Thanks, Titus.
Is there anyway to just have it log the error go the log file instead of
quitting the program? I remove the code 200 assert statement and reran
the script with 'redirect_error (errorlog.log)' but no entries exist in
this file where errors occured.
Thoughts?
On Wed, 2008-10-01 at 20:40 -0700, C. Titus Brown wrote:
> 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