Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
argv IndexError
#1
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.
Reply
#2
Look at my answer here.
Reply
#3
thanks,you saved me .
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 752 May-02-2023, 08:40 AM
Last Post: Gribouillis
  sys.argv method nngokturk 3 1,027 Jan-23-2023, 10:41 PM
Last Post: deanhystad
  import argv Scott 3 5,837 Apr-01-2021, 11:03 AM
Last Post: radix018
  use of sys.argv deepakkr3110 3 3,003 Nov-29-2019, 05:41 AM
Last Post: buran
  Not all data returned from sys.argv ecdhyne 2 2,723 Sep-05-2019, 08:27 PM
Last Post: buran
  Pyinstaller with Sys.Argv[] - “Failed to Execute Script”? ironfelix717 0 5,257 Aug-07-2019, 02:29 PM
Last Post: ironfelix717
  I see is that sys.argv contains character strings helenharry 2 2,715 Jan-09-2019, 11:34 AM
Last Post: DeaD_EyE
  How argv works? Philia 7 4,758 Dec-26-2018, 12:20 AM
Last Post: metulburr
  sys.argv correct sintax? enricosx 3 3,173 Jul-25-2018, 09:27 AM
Last Post: buran
  I gotta problem with making argv parameters Bozx 3 4,014 Apr-04-2017, 03:44 AM
Last Post: alicarlos13

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020