Python Forum
Will not print in command prompt
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Will not print in command prompt
#1
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
Reply
#2
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
Reply
#3
@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 can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#4
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.
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply
#5
first save the file at a place and then run your program
Reply
#6
(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.
Reply
#7
content removed by moderator
Reply
#8
@tonytech,
Please, if you want to help, please do it here in he forum, so that anyone can benefit in the future
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#9
How I do it. Hope it helps.
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply
#10
@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?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to Randomly Print a Quote From a Text File When User Types a Command on Main Menu BillKochman 13 828 Yesterday, 05:47 AM
Last Post: Bronjer
  problem with print command in super() akbarza 5 596 Feb-01-2024, 12:25 PM
Last Post: deanhystad
  What is the difference between Command Prompt and Sublimes yaoyao22 1 643 Jul-09-2023, 02:56 PM
Last Post: snippsat
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,095 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Facing Problem while opening a file through command prompt vlearner 4 1,914 Jan-30-2022, 08:10 AM
Last Post: snippsat
  Why does absence of print command outputs quotes in function? Mark17 2 1,387 Jan-04-2022, 07:08 PM
Last Post: ndc85430
  Using print command to send command to rasberry pi terminal MondazeBear 2 1,876 Aug-02-2021, 03:15 PM
Last Post: Larz60+
  Noob warning: trying to use pip to install pytest and pep8 in Command Prompt adifrank 4 5,336 Dec-20-2020, 04:23 AM
Last Post: adifrank
  Running Python in Command Prompt Anwar 3 3,087 Nov-15-2020, 03:15 PM
Last Post: snippsat
  starting python from windows command prompt MaartenRo 4 2,850 Sep-04-2020, 12:25 PM
Last Post: MaartenRo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020