Python Forum
Will not print in command prompt - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Will not print in command prompt (/thread-26532.html)

Pages: 1 2


Will not print in command prompt - PandaCode - May-05-2020

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


RE: Will not print in command prompt - tonytech - May-05-2020

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


RE: Will not print in command prompt - buran - May-05-2020

@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?


RE: Will not print in command prompt - menator01 - May-05-2020

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.


RE: Will not print in command prompt - MohammedSohail - May-05-2020

first save the file at a place and then run your program


RE: Will not print in command prompt - PandaCode - May-06-2020

(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.


RE: Will not print in command prompt - tonytech - May-06-2020

content removed by moderator


RE: Will not print in command prompt - buran - May-06-2020

@tonytech,
Please, if you want to help, please do it here in he forum, so that anyone can benefit in the future


RE: Will not print in command prompt - menator01 - May-06-2020

How I do it. Hope it helps.



RE: Will not print in command prompt - buran - May-06-2020

@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?