looks like it is expecting command line agrs that are not there. put this at the top of your code to see what's going on
import sys print sys.argv remembering that the first element printed is sys.argv[0] -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Mark Sent: Tuesday, March 13, 2007 10:04 AM To: python-list@python.org Subject: i can`t get python working on the command line (linux) [html-removed] Hey, first of all: sorry for the 100% n00b question i`m brand new to python and i seem to start off with the biggest problem of all.. not even getting python to work. i`m running Fedora core 7 test 2 and all the python based applications are working fine (like pirut, pipet, and some other yum related tools) but when i try to run this script: #!/usr/bin/python # # python script tel.py # gevonden door Jan Mooij 24 september 2000 # from sys import * from string import * # Create an empty dictionary. count = {} for line in open(argv[1], 'r').readlines(): for word in split(line): if count.has_key(word): count[word] = count[word] + 1 else: count[word] = 1 words = count.keys() words.sort() for word in words: print "%15s\t%10d" % (word, count[word]) and i`ve put it in tel.py (just the same as in the sample) than chmod it to 777 (just to make sure it isn`t a permission issue) and than i run it with: ./tel.py now this is the error that i get: Traceback (most recent call last): File "./tel.py", line 12, in <module> for line in open(argv[1], 'r').readlines(): IndexError: list index out of range also i`m not even getting the most simple sample code to work.. "Hello World". everything works fine when i first enter the python console by typing python. than i have the >>> things than print "Hello World" gives me the expected result but that`s not what i want.. i want to do it from a file.. the solution is probable extremely simple but i have no idea as a complete n00b in python. i do have alot php experience. hope someone could help me out with this. o and any function that i use in python gives me "command not found: print/whatever function i use" (probable just a simple yum install command that i need to do to get this working.. just try to figure that out with no python knowledge) Thanx alot in favor. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list