[Tutor] Python Error Message

Peter Otten __peter__ at web.de
Wed Jan 27 04:52:09 EST 2021


On 27/01/2021 10:07, Alan Gauld via Tutor wrote:
> On 27/01/2021 03:36, Nirel Leitman via Tutor wrote:
>> Thank you.  And yes, degrees.py is also a folder name along with small.
> 
> In that case you are trying to get Python to execute a folder, which
> won't work.

When you invoke the interpreter with a directory

PS C:\Users\Peter> py some_folder

Python will look for a file

some_folder/__main__.py

and fail with an error message similar to the one that the OP got:

C:\Program Files\Python39-32\python.exe: can't find '__main__' module in 
'C:\\Users\\Peter\\some_folder'

Nirel, do yourself and us a favor and use the .py suffix for Python 
files exclusively. Adding .py to a directory can even confuse the experts.



More information about the Tutor mailing list