[issue8890] Use tempfile instead of /tmp in examples

2010-11-20 Thread Mauro Navarro Baraldi

Mauro Navarro Baraldi  added the comment:

Replace to most use of /tmp/tempfile for just tempfile, as sugested before.

--
keywords: +patch
nosy: +maurobaraldi
Added file: http://bugs.python.org/file19698/py3k-docs.patch

___
Python tracker 
<http://bugs.python.org/issue8890>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8890] Use tempfile instead of /tmp in examples

2010-11-21 Thread Mauro Navarro Baraldi

Mauro Navarro Baraldi  added the comment:

Reviewing this thread and talking with another friends, I thought that the 
pythonic way to solve it should be use the tempfile module.

And here is a suggestion using the logging module with tempfile.

> import logging
> import tempfile
> fp, LOG_FILENAME = tempfile.mkstemp(suffix=".log")
> logging.basicConfig(filename=LOG_FILENAME, level=logging.DEBUG)
> logging.debug('This message should go to the log file')
> LOG_FILENAME
'/tmp/tmprBhZz1.log'

--
components: +Demos and Tools -Documentation

___
Python tracker 
<http://bugs.python.org/issue8890>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com