On 24 mai, 18:48, Tartifola <[EMAIL PROTECTED]> wrote: > Hi, > suppose a script of python is waiting for a file from the stdin and none > is given. How can I make the script to stop and, for example, print an > error message? > > Sorry for the n00b question and thanks
import sys import os.path if len(sys.argv)<2: print >>sys.stderr, 'Usage: %s filename' % (os.path.basename(sys.argv[0]),) sys.exit(1) print 'Your filename is %s' % (sys.argv[1],) -- http://mail.python.org/mailman/listinfo/python-list