Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
229,732 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
229,732 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
229,732 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
229,732 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.