0

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.

0

1 Answer 1

11

you need to close this )

text = ''.join(sys.argv[3:]
Sign up to request clarification or add additional context in comments.

2 Comments

Epic facepalm. Note to self: Interpreter is not very accurate at locating syntax errors. Check in more detail next time.
@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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.