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

Zachary Kaufman
Zachary Kaufman
1,463 Points

Help with testing files!!

I just got a new computer (Running Windows 10) and I have already downloaded python. I made the shopping list 3 application, and I want to run it on command prompt. I opened the python shell and then typed in shopping_list.py (thats what the file is called I wrote it using Atom script editor and saved it) and the command prompt gives me back the error

C:\Users\zkauf>python Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. (triple greater than symbol) shopping_list.py Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'shopping_list' is not defined (triple greater than symbol)

Any help appreciated thanks!!

Neil Anuskiewicz
Neil Anuskiewicz
11,007 Points

I'd say it'd be best to post your code here, not that I personally will know the answer but there's a better chance someone will be able to help with the code handy. It's good to have the error and the code. It's best to post the code using the markdown syntax. See "Markdown Cheatsheet" below....

One thing I will say is that while I'm not a developer, I'm in that environment and literally nobody at the company uses Windows. It's all Mac OS X or Linux. I don't know if this is the situation at all all software companies and creative shops but it's worth thinking about a bit.

I'm not saying dump your Windows box tomorrow but it's worth considering what tools people use that are working on the stuff that interests you.

2 Answers

Kourosh Raeen
Kourosh Raeen
23,733 Points

Instead of the python shell, open a command prompt, then go to the directory where shopping_list.py is and type:

python shopping_list.py
Neil Anuskiewicz
Neil Anuskiewicz
11,007 Points

Also, I'd post your whole script here. There might be some Python gurus who could have a strong hunch based on the error but most students here would need the code, IMO.

Zachary Kaufman
Zachary Kaufman
1,463 Points

Neil, the reason I got a new computer is because I damaged the hard drive of my last one trying to switch to Linux for that reason haha. And thanks Kourosh I will try that! I have a virtual machine too I will download Linux on that if necessary.

Neil Anuskiewicz
Neil Anuskiewicz
11,007 Points

Now it's cool, you sacrificed trying to install Linux. :-)

Zachary Kaufman
Zachary Kaufman
1,463 Points

Haha my parents who paid for a new laptop did not find it as cool.