Python Forum

Full Version: argv IndexError
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
WuHere's my question link:

https://answers.yahoo.com/question/index...154AAO3AKj
The following is what's contained in the link - Admin

i was trying to create a new programming language interpreter with python,but after just a few lines ,i tested it, i have this following error:
Error:
Traceback (most recent call last): File "C:\Users\User\Desktop\project teik\shortcut\codime interpreter\interpreter.py", line 11, in <module> run() File "C:\Users\User\Desktop\project teik\shortcut\codime interpreter\interpreter.py", line 8, in run open_file(argv[1]) IndexError: list index out of range
my current code:
from sys import argv 

def open_file(filename): 
   print(filename) 

def run(): 
   open_file(argv[1]) 

run()
note:the filename is test.codime and i put it in the same folder with this python project(the filename is interpreter.py)
Update: i have not started creating the lexer and parser yet.
Update 2: i am using the latest version of python
Update 3: just for your information, the new programming language name is codime.
Look at my answer here.
thanks,you saved me .