October 22, 2024
Chicago 12, Melborne City, USA
python

Execute .py file from the wsl shell


I’m trying to execute a simple hello.py file from the shell (a wsl really), but apparently it doesn’t work. I used the following command to be sure to be in the directory containing the .py file:
import os
os.getcwd()
The error is always the following: NameError: name’hello.py’ is not defined. Any suggestion?

I tried many possible solutions but no one of them worked. For example I tried to write python3 hello.py without success.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video