Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32835
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: Logging output to be redirected to a particular folder |
| Date | 2012-11-06 12:38 -0500 |
| Organization | > Bestiaria Support Staff < |
| References | <bdec816f-bde8-427a-b604-30e12a773595@googlegroups.com> <k7avku$ecv$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3333.1352223519.27098.python-list@python.org> (permalink) |
On Tue, 06 Nov 2012 13:26:11 +0100, Peter Otten <__peter__@web.de>
declaimed the following in gmane.comp.python.general:
> anuradha.raghupathy2010@gmail.com wrote:
>
> > Hi,
> >
> > Below is the python code that I have. I want to redirect the output to my
> > C drive..myapp.log.
> >
> > I am editing and creating scripts in IDLE and running it as a python shell
> > or module.
> >
> > Can you help?
> >
> > import logging
> >
> > def main():
> > logging.basicConfig(Filename='c://myapp.log', level=logging.ERROR)
>
> Python is case-sensitive. Try:
>
> logging.basicConfig(filename='c://myapp.log', level=logging.ERROR)
>
The double forward slashes might also be confusing... At the least,
unneeded...
>>> import os.path
>>> print os.path.normpath("c://somefile.log")
c:\somefile.log
>>> print os.path.normpath("c:\\somefile.log")
c:\somefile.log
>>> print os.path.normpath("c:\\tryfile.log")
c:\tryfile.log
>>> print os.path.normpath("c:\tryfile.log")
c: ryfile.log
>>> print os.path.normpath("c:/tryfile.log")
c:\tryfile.log
>>>
Doubling back-slashes is needed to avoid the problem of literal
escapes corrupting the intent...
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Logging output to be redirected to a particular folder anuradha.raghupathy2010@gmail.com - 2012-11-06 03:28 -0800
Re: Logging output to be redirected to a particular folder Peter Otten <__peter__@web.de> - 2012-11-06 13:26 +0100
Re: Logging output to be redirected to a particular folder Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-06 12:38 -0500
RE: Logging output to be redirected to a particular folder "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-06 17:58 +0000
Re: Logging output to be redirected to a particular folder anuradha.raghupathy2010@gmail.com - 2012-11-06 22:39 -0800
Re: Logging output to be redirected to a particular folder anuradha.raghupathy2010@gmail.com - 2012-11-06 22:39 -0800
csiph-web