Image

i'm puzzled i'm trying to get a program i worte to run when evoked from the command line... and it wasn;t working so i tol it to print the arguments it has when starting and i got nothing... i wrote another program with the exact same syntax just without the rest of the program, just to print the arguments, and it worked..

#! /usr/bin/python
import sys, os, string


def main(argv):
	print argv
	names=open(argv, 'r').read()
	names = names[2:].split('\n')
	names[1:] = names
	groups = ['']
	for a in names:
		if len(a) != 0:
			if a[0] == 'g':
				groups.append(a[2:])
				print groups.pop()
			elif a[0] == 'b':
				print '   ',a[2:]

if __name__ == '__main__':
	main(sys.argv[1])

when running :sort 'filename of buddylist' i get a screwed up printed version and no arguments??

here's the slimmed down version
#! /usr/bin/python
import sys, string, os

def main(argv):
        print argv

if __name__ == '__main__':
        main(sys.argv[1])

they are essiently the same thing untill after the print argv
however this one works

i'm very puzzled