Skip to content

Instantly share code, notes, and snippets.

@funrep
Created October 28, 2012 10:56
Show Gist options
  • Save funrep/3968311 to your computer and use it in GitHub Desktop.
Save funrep/3968311 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python2.7
import os, sys, getopt
def main():
opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="])
for o, a in opts:
output = a
if o in ("-u", "--update"):
os.system('sudo pacman -Syu')
os.system('sudo lilo')
elif o in ("-h", "--help"):
print '"-u" update system, "-h" show this message'
sys.exit()
else:
print "ERROR ERROR ERROR 61486112"
sys.exit()
if __name__ == "__main__":
main()
i get this error on "./update -u"
$ ./update.py -u
Traceback (most recent call last):
File "./update.py", line 22, in <module>
main()
File "./update.py", line 7, in main
opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="])
File "/usr/lib/python2.7/getopt.py", line 90, in getopt
opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])
File "/usr/lib/python2.7/getopt.py", line 190, in do_shorts
if short_has_arg(opt, shortopts):
File "/usr/lib/python2.7/getopt.py", line 206, in short_has_arg
raise GetoptError('option -%s not recognized' % opt, opt)
getopt.GetoptError: option -u not recognized
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment