views:

78

answers:

1

This code:

class Todo:
 def addto(self, list_name="", text=""):
  """
  Adds an item to the specified list.
  """
  if list_name == "":
   list_name = sys.argv[2]
   text = ''.join(sys.argv[3:]

  todo_list = TodoList(getListFilename(list_name))

produces a syntax error with the little arrow pointing to todo_list on the last line.

The __init__ method for TodoList is here:

def __init__(self, json_location):
 """
 Sets up the list.
 """
 self.json_location = json_location
 self.load()

I am kind of new to Python, so I don't see what I am doing wrong here.

+11  A: 

you need to close this )

text = ''.join(sys.argv[3:]
jbochi
*Epic facepalm*. Note to self: Interpreter is not very accurate at locating syntax errors. Check in more detail next time.
Macha
LOL. This has already happened to me a couple of times ;)
jbochi
@Macha: Actually, it's deadly accurate locating the syntax errors. Don't let your assumptions about previous lines of code cloud your interpretation of the error message. The statement -- without the closing `)` can continue on until it's clear that some punctuation is missing.
S.Lott