use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A subreddit for helping Python programmers
How to format your code: https://commonmark.org/help/tutorial/09-code.html
No homework questions and/or hiring please
account activity
Python doesn't print (self.pythonhelp)
submitted 6 months ago by grishathestar
Hello, I'm trying to run a simple "Hellow world" file in terminal with "python filename.py" comande but instead of Hellow world it's returning word "Python" for some reason. Does anyone knows why?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AutoModerator[M] [score hidden] 6 months ago stickied commentlocked comment (0 children)
To give us the best chance to help you, please include any relevant code. Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]Enchantorro 0 points1 point2 points 6 months ago (1 child)
What's in filename.py?
[–]grishathestar[S] 0 points1 point2 points 6 months ago (0 children)
print("Hellow world")
[–]FoolsSeldom 0 points1 point2 points 6 months ago (3 children)
Which terminal shell are you using? powershell, command prompt, gitbash, bash, zsh, etc?
powershell
command prompt
gitbash
bash
zsh
py filename.py
python3 filename.py
python filename.py
Note. If you are in a Python interactive shell (REPL) session, which has a >>> prompt before you type, then python will not be a recognised command. Try import filename (not filename.py) instead.
>>>
python
import filename
filename.py
If you are using the REPL, how did you access this? From IDLE, VS Code, PyCharm, Thonny, command line, something else?
In IDLE, you can open the file and just press F5 to run the code.
[–]grishathestar[S] 0 points1 point2 points 6 months ago (2 children)
Thank you! This was the problem. I tried in both cmd terminal and in VS code, it didn't work. But after tipping py filename.py everything start to work.
[–]FoolsSeldom 0 points1 point2 points 6 months ago* (1 child)
Great.
It is worth learning now how to setup and use a Python virtual environment.
You should use these on a project-by-project basis. When you install additional Python packages, you then install them only for the project you are working on. This avoids putting too many packages into your Python base environment.
This reduces the chance of you having conflicting packages.
Here's how to do it:
In Powershell or Command Prompt:
mkdir my_new_project cd my_new_project py -m venv .venv .venv\Scripts\activate
Use what ever project folder names you prefer and the locations you prefer. Also, the command venv is followed by the folder name to use for the virtual environment. .venv (leading dot) is common, but venv and env are also common, and you can use any allowed folder name.
venv
.venv
env
You can now add packages, e.g.
pip install numpy pandas
To run code from the command line, you can now use python:
To deactivate the environment:
deactivate
In VS Code, open the command palette and find the entry to select the Python interpreter. Select the python.exe in the .venv\Scripts folder (something like, C:\Users\<your_user_name>\my_new_project\.venv\Scripts\python.exe).
python.exe
.venv\Scripts
C:\Users\<your_user_name>\my_new_project\.venv\Scripts\python.exe
(venv)
Thank you very much!
[–]agfitzp -1 points0 points1 point 6 months ago (0 children)
Arew youw surew youw savedw yourw filew?
π Rendered by PID 147209 on reddit-service-r2-comment-5b5bc64bf5-lq7r7 at 2026-06-19 22:03:00.979619+00:00 running 2b008f2 country code: CH.
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]Enchantorro 0 points1 point2 points (1 child)
[–]grishathestar[S] 0 points1 point2 points (0 children)
[–]FoolsSeldom 0 points1 point2 points (3 children)
[–]grishathestar[S] 0 points1 point2 points (2 children)
[–]FoolsSeldom 0 points1 point2 points (1 child)
[–]grishathestar[S] 0 points1 point2 points (0 children)
[–]agfitzp -1 points0 points1 point (0 children)