durusmail: quixote-users: where do mod_python print statements go?
where do mod_python print statements go?
2001-10-12
2001-10-12
2001-10-12
2001-10-12
2001-10-12
2001-10-12
2001-10-15
2001-10-15
2001-10-15
2001-10-15
2001-10-15
2001-10-15
2001-10-15
where do mod_python print statements go?
Ray Drew
2001-10-15
> -----Original Message-----
> From: Greg Ward [mailto:gward@mems-exchange.org]
> Sent: 12 October 2001 15:29
> To: quixote-users@mems-exchange.org
> Subject: Re: [Quixote-users] where do mod_python print statements go?
>
>
> On 12 October 2001, Johann Visagie said:
> > Expert, no.  But the DOS/Windows null device is indeed NUL.
>  I've just
> > checked that this still exists on Win2K, at least.
>
> Great.  Can someone intrepid Quixote-on-Windows user try a few things
> for us:
>
>   * set DEBUG_LOG = None in the config file and start a Quixote
>     application (eg. access "/q/" if you've installed the demo
>     according to the instructions in doc/demo.txt)
>
>   * if Windows does not recognize "/dev/null" (as we
> suspect), it should
>     crash

with Apache 1.03/Win NT4/mod_python it does crash with the following
output..

Mod_python error: "PythonHandler quixote.mod_python_handler"

Traceback (most recent call last):

  File "D:\bin\Python21\Lib\mod_python\apache.py", line 193, in Dispatch
    result = object(req)

  File "D:\bin\Python21\quixote\mod_python_handler.py", line 48, in handler
    name2publisher[package].setup_logs()

  File "D:\bin\Python21\quixote\publish.py", line 136, in setup_logs
    sys.stdout = open('/dev/null', 'w')

IOError: [Errno 2] No such file or directory: '/dev/null'

[...]

> Then try applying this patch:
>
> --- publish.py  2001/10/09 21:38:15     1.99
> +++ publish.py  2001/10/12 14:25:09
> @@ -44,2 +44,11 @@
>
> +if os.name == "posix":
> +    NULL_FILE = "/dev/null"
> +elif os.name == "nt":
> +    NULL_FILE = "NUL"
> +else:
> +    # Will bomb if-and-only-if we enter setup_logs() with
> +    # config.debug_log unset.
> +    NULL_FILE = None
> +
>  class Publisher:
> @@ -136,3 +145,3 @@
>              # to the bit-bucket.
> -            sys.stdout = open('/dev/null', 'w')
> +            sys.stdout = open(NULL_FILE, 'w')
>          else:
>
> ...and see if it works (ie. doesn't crash) this time.

Yes that worked for me.

Thanks,

Ray Drew

CONFIDENTIALITY - The information in this e-mail and any attachment is
confidential and is intended only for the named recipient(s).  The E-mail
may not be disclosed or used by any person other than the addressee, nor may
it be copied in any way.  If you are not a named recipient please notify the
sender immediately and delete any copies of this message.


reply