1

Absolute novice with programming. Apparently I was wasting a members time with 10 words about myself so here is my edit and question sans any personality. :)

This morning, I opened up my laptop to practice (Mac OS 10.11.6). Reopened IDLE and the files from yesterday and continued practicing when I noticed the shell was not outputting anything unless I told it to print. In the editor I have:

1-1
x_list = [1,2,3]
x_list
print(x_list)

The shell returns this:

    >>> 
 RESTART: /Users/plaksatyler/Desktop/Python Practice Code/Do Not Give Up/GibberishTest.py 
>>> 
 RESTART: /Users/plaksatyler/Desktop/Python Practice Code/Do Not Give Up/GibberishTest.py 
>>> 
 RESTART: /Users/plaksatyler/Desktop/Python Practice Code/Do Not Give Up/GibberishTest.py 
[1, 2, 3]
>>> 

I've removed and reinstalled IDLE two times, upgraded PIP and ran the Shell update command because I have no clue what to do. Any ideas would be greatly appreciated. Thanks!

Screenshot

5
  • can you give us an example of the code you are running, I dont see a screenshot btw Commented Jul 26, 2018 at 17:56
  • sorry, thought the site said it was adding a link since I'm new. Will edit now Commented Jul 26, 2018 at 17:59
  • You actually don't need to include a screenshot if you're providing code and/or errors in text form (text is preferred over screenshots). Commented Jul 26, 2018 at 18:06
  • Unpopular opinion: I prefer text and screenshots, in particular for problems of the form "why isn't my IDE working right?", because often the problem is happening outside of the code window. Commented Jul 26, 2018 at 18:09
  • @Kevin I mentioned it because OP is a new user (this is their first question) and it might save them time in future when it's mostly unnecessary to provide sreenshots in addition to text. Commented Jul 26, 2018 at 18:17

1 Answer 1

2

This is not a glitch. When you are running programs from a file, only things that you tell it to print will be printed.

When you run it by typing in the lines (with the >>>), all of the results will be printed.

Imagine how annoying it would be if every single line produced output in IDLE. Usually you only need to output things like results or messages.

If you want to use IDLE as a "programming calculator", you can just type everything into the shell (AKA >>> window), not the editor.

Sign up to request clarification or add additional context in comments.

2 Comments

Excuse my naïveté. So this is normal and happens to everyone? I never recalled seeing that "RESTART" line before but maybe I'm just crazy.
@Tyler_P the RESTART line appears when you run a .py file. What you were doing yesterday was probably typing the lines directly into the >>> shell. When you run a file that already has the lines in it, IDLE just executes each line, not printing out the result. When programming in Python, if you want output you need to use print.The IDLE shell just allows that "interactive mode" to help you experiment with simple commands and such. Also, it is useful when a program has finished and you want to inspect some of the variables. You can just type them in and it will say their value.

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.