Python Forum

Full Version: Will not print in command prompt
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello,

My instructor has us write a simple code using Atom to run in command prompt. When the instructor ran his code in the video it displayed the intended text. When I replicated it and attempted to run the code using command prompt it did not do print the text.

The code was simply
print('I am learning python')

The instructors command prompt displayed the text I am learning python.
When I ran mine it did not display the text, just showed the file location again.

Would anyone know why this is or how to trouble shoot it? So far I reset command prompt and Atom.

Thank you
If you're on console did you call python3 first?

Try issuing command (excluding the #) below

#python3


You should see some arrows like so.

>>>>

On these arrows enter your print statement and press enter
@tonytech, don't confuse OP further. They are clearly not in interactive mode (python shell).

@PandaCode - can you show how you run the code? Did you save the .py file after you added your code?
If you are using atom you will need to install the add on script module.
Write and save your file.
Ctl-shift-b will run the code
If you are using atom to run it.
first save the file at a place and then run your program
(May-05-2020, 08:06 AM)buran Wrote: [ -> ]@tonytech, don't confuse OP further. They are clearly not in interactive mode (python shell).

@PandaCode - can you show how you run the code? Did you save the .py file after you added your code?

Thank you very much.

I definitely saved it as a .py file.

In the command prompt the full line is:

C:\Users\Aarons\OneDrive\Desktop\AProjects>python AssignmentOne.py

I also tried running it with python3 but it still diddnt print the line.
I downloaded the script add on for atom and hit ctrl-shift-b but it gave error.
Python was not found but can be installed from the microsoft store*link*. I have Python 3.88 32 bit installed.
content removed by moderator
@tonytech,
Please, if you want to help, please do it here in he forum, so that anyone can benefit in the future
How I do it. Hope it helps.
@menator01, OP is on Windows. No need for chmod
@PandaCode, Assuming you have the following code in AssignmentOne.py:
print('I am learning python')
this, what you do, should work.
Output:
C:\Users\Aarons\OneDrive\Desktop\AProjects>python AssignmentOne.py
can you show a screenshot of your Atom window along side the cmd window?
Pages: 1 2