#- main (args): #- fhand=open(args[1:],"r+") This is because args[1:] returns a list, and you need a string. See: >>> mylist = ["first", "myfile.txt", "third"] >>> mylist[1:] ['myfile.txt', 'third'] >>> mylist[2] 'third' >>> . Facundo