[Python-checkins] CVS: python/dist/src/Demo/scripts from.py,1.7,1.8
Moshe Zadka
moshez@users.sourceforge.net
Tue, 20 Feb 2001 08:21:37 -0800
Update of /cvsroot/python/python/dist/src/Demo/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv22541
Modified Files:
from.py
Log Message:
Fixed to use new Python features and use more commonly accepted style
Reindented
Index: from.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/scripts/from.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** from.py 1996/11/27 19:46:50 1.7
--- from.py 2001/02/20 16:21:35 1.8
***************
*** 10,35 ****
try:
! mailbox = os.environ['MAIL']
except (AttributeError, KeyError):
! sys.stderr.write('No environment variable $MAIL\n')
! sys.exit(2)
try:
! mail = open(mailbox, 'r')
except IOError:
! sys.stderr.write('Cannot open mailbox file: ' + mailbox + '\n')
! sys.exit(2)
while 1:
! line = mail.readline()
! if not line: break # EOF
! if line[:5] == 'From ':
! # Start of message found
! print line[:-1],
! while 1:
! line = mail.readline()
! if not line: break # EOF
! if line == '\n': break # Blank line ends headers
! if line[:8] == 'Subject:':
! print `line[9:-1]`,
! print
--- 10,35 ----
try:
! mailbox = os.environ['MAIL']
except (AttributeError, KeyError):
! sys.stderr.write('No environment variable $MAIL\n')
! sys.exit(2)
try:
! mail = open(mailbox)
except IOError:
! sys.exit('Cannot open mailbox file: ' + mailbox)
while 1:
! line = mail.readline()
! if not line:
! break # EOF
! if line.startswith('From '):
! # Start of message found
! print line[:-1],
! while 1:
! line = mail.readline()
! if not line or line == '\n':
! break
! if line.startswith('Subject: '):
! print `line[9:-1]`,
! print