Python equivalent to Perl's warn/confess/die

Andy Lester andy at
Wed May 24 16:10:38 CEST 2000

I looked in the Perl/Python phrasebook and didn't see anything that
discusses an easy way to write warnings to the screen.

For instance, in Perl if I wanted to write something to stderr to show
where in my process I am, I'd say:

  warn "$n records read";

Now, I know I can say

  sys.stderr.write( '%s records read' % n ) 

But is there a module somewhere that encapsulates that so I don't
explicitly send it to stderr?


Andy Lester, andy at,
    "Inflammable material is planted in my head
     It's a suspect device that's left two thousand dead."
    "Hey, is this the new Green Day?"

More information about the Python-list mailing list