import twitter, sys
api = twitter.Api()
USERNAME = 'YOUR_TWITTER_USERNAME'
PASSWORD = 'YOUR_TWITTER_PASSWORD'
api = twitter.Api(username=USERNAME, password=PASSWORD)
if len ( sys.argv ) > 1:
message = sys.argv[1]
else:
message = raw_input('Your twitter message: ')
status = api.PostUpdate( message )
You're going to need Python twitter installed, of course.