I have a script that processes command line arguments

def main(argv=None):
    syslog.syslog("Sparkler stared processing")
    if argv is None:
        argv = sys.argv
    if len(argv) != 2:
        syslog.syslog(usage())
    else:
        r = parseMsg(sys.argv[1])
        syslog.syslog(r)
    return 0

if __name__ == "__main__":
    sys.exit(main())

When I run "python myscript fred" it works as expected - the argument fred
is processed in parseMsg as sys.arv[1]

When I run "echo fred | python myscript" the script thinks there are no
arguments, so it prints out the usage statement.

Is the problem with the echo command, or how I wrote my script?

Thanks!

Mark
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to