Ok that doesn't work -- I'll get someone to work out what's happened with storage, in the meantime here is the code:
#
# Send a status via Twitter, takes user,pass and msg from the command line
#
# Andy Harris, WebBrick Systems, no rights reserved
# 4th August 2009
#
import getopt, sys, twitter
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "h:v", ["help", "msg=","user=","pass="])
except getopt.GetoptError, err:
print str(err) # will print something like "option -a not recognized"
usage()
sys.exit(2)
message = None
username = None
password = None
verbose = False
print "The opts %s" % opts
for o, a in opts:
if o == "-v":
verbose = True
elif o in ("-h", "--help"):
usage()
sys.exit()
elif o in ("-m", "--msg"):
print "o %s and a %s" % (o,a)
message = a
elif o in ("-u", "--user"):
print "o %s and a %s" % (o,a)
username = a
elif o in ("-p", "--pass"):
print "o %s and a %s" % (o,a)
password = a
else:
assert False, "unhandled option"
api = twitter.Api(username,password)
api.PostUpdate(message)
def usage():
print "Usage problem, check your params --user uname --pass passwd --msg theMessage"
if __name__ == "__main__":
main()