[ python-Bugs-1235266 ] debug info file descriptor of tarfile is inconsistent

SourceForge.net noreply at sourceforge.net
Mon Jul 11 08:19:19 CEST 2005


Bugs item #1235266, was opened at 2005-07-09 18:24
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1235266&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: George Yoshida (quiver)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: debug info file descriptor of tarfile is inconsistent

Initial Comment:
"7.19.1 TarFile Objects" says
  The messages are written to sys.stdout.
but they are actually written to sys.stderr ::

  def _dbg(self, level, msg):
      """Write debugging output to sys.stderr.
      """
      if level <= self.debug:
          print >> sys.stderr, msg

There are 2 options:
(a) change document from stdout to stderr.
(b) rewrite the code to use stdout.

Given this is debug messages and most other modules 
use stdout for debug printing(gc is one of the few 
exceptions?), I'm +1 on (b).

[*] http://docs.python.org/lib/tarfile-objects.html


----------------------------------------------------------------------

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-07-11 08:19

Message:
Logged In: YES 
user_id=1188172

Attaching patches for both tarfile and zipfile. For tarfile,
the docs are changed to stderr, for zipfile, both docs and
implementation are changed to stderr.

Since I don't assume that someone actually uses the debug
info in some automated way, I think we can correct this in 2.5.

Raymond, please review.

----------------------------------------------------------------------

Comment By: George Yoshida (quiver)
Date: 2005-07-10 18:26

Message:
Logged In: YES 
user_id=671362

OK. I tested some GNU compression/decompression tools 
and comfirmed that they write debugging messages
(displayed in verbose mode(-v)) to stderr.

Now I'm leaning toward Reinhold's idea.

> What about zipfile? 
> Should we print debug info to stderr there, too?

Maybe yes.  I'd be happy to volunteer for that patch.


----------------------------------------------------------------------

Comment By: Lars Gustäbel (gustaebel)
Date: 2005-07-10 10:00

Message:
Logged In: YES 
user_id=642936

This is a documentation error. Debug messages must go to
stderr because that's what stderr is for. Think of a script
that writes a tar archive to stdout for use in a unix shell
pipeline. If debug messages went to stdout, too, it would
produce unusable output, because archive data and debug
messages would be mixed.


----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-07-09 19:04

Message:
Logged In: YES 
user_id=1188172

The documentation seems to be borrowed from zipfile, where
the statement is true: debug info is written to stdout.

I'm in favour of changing the docs to stderr for tarfile.
What about zipfile? Should we print debug info to stderr
there, too?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1235266&group_id=5470


More information about the Python-bugs-list mailing list