Python Python Basics (2015) Shopping List App Shopping List Introduction

Command not found error

Hi Team,

When I used the following code:

# make a list to hold our items
shopping_list = []

# print out instructions on how to use the app
print("What should we pick up at the store?")
print("Enter DONE to quit the app.")

# ask for new items
while True:
  new_item = ("> ")

  # be able to quit the app  
  if new_item == 'DONE':
    break

  # add new items to our list
  shopping_list.append(new_item)

# print out the list
print("Here's your list:")

for item in shopping_list:
  print(item)

I kept getting a bash: (whatever item I typed in) : command not found error. Please advise, thank you!

Steven Parker
Steven Parker
172,268 Points

What command are you typing and what is the name of the file that contains this code?

5 Answers

Sigurd Melsom
Sigurd Melsom
6,107 Points

What command are you typing in?

Hi Steven/ Sigurd

I am working on the shopping list program under the Python Basics course. The name of the file that contains this code is shopping_list.py.

Steven Parker
Steven Parker
172,268 Points

You didn't show the command you were using, but to start this program from the command line, I would expect you to enter:

python shopping_list.py

Hi Steven

I was using workspaces instead of command line.

Steven Parker
Steven Parker
172,268 Points

The "command line" I was referring to would be what you type into the Console window of the workspace. The same place you might get the "command not found" error.

Hi Steven

It would be treehouse:~/workspace$ python shopping_list.py.

Sorry, total newbie here.

Steven Parker
Steven Parker
172,268 Points

Yes, that's the command that should run your program. I only showed the part you type in.

If it's not working, then to facilitate a more complete analysis of the situation, make a snapshot of your workspace and post the link to it here.