Hi all! When I am on the project, I cannot run it. Python says he does not find my "main" file.
Here is my main.py:
if __name__ == '__main__':
import handling_num
import factorial
import case
import sort
import chaotic
import solver
import roule
import while_True
import game_tk
import game
Show the error.
Python would not do anything but return as complete, since all you are doing here is importing stuff.
Error:
E:\Documents>python Py1
C:\Program Files\Python36\python.exe: can't find '__main__' module in 'Py1'
E:\Documents>
Strange ! I am on E he goes to C. That may be the reason. But why he does not rest on E ?
I must add that with "python main.py", all the project runs well.
There is no reason why this should cause an error.
I don't have same packages as you, so used a couple different for import,
but created following python program
dingo.py:
λ cat dingo.py
if __name__ == '__main__':
import sys
import tkinter
then ran:
λ python dingo.py
without issue
#λ cat dingo.py
if __name__ == '__main__':
import sys
import tkinter
First line commented or not , file doesn't work. Now error in case first line cmmented:
Error:
E:\Documents\new_files>python f3.py
File "f3.py", line 1
λ cat dingo.py
^
SyntaxError: invalid syntax
E:\Documents\new_files>python f3.py
E:\Documents\new_files>python f3.py
E:\Documents\new_files>
(Mar-04-2018, 07:48 PM)sylas Wrote: [ -> ]#λ cat dingo.py
if __name__ == '__main__':
import sys
import tkinter
First line commented or not , file doesn't work. Now error in case first line cmmented:
Error:
E:\Documents\new_files>python f3.py
File "f3.py", line 1
λ cat dingo.py
^
SyntaxError: invalid syntax
E:\Documents\new_files>python f3.py
E:\Documents\new_files>python f3.py
E:\Documents\new_files>
HIs first line is a bash command to output the fie to show you the contents. If you commented that out and get no output that means it worked as nothing is suppose to output from importing usually.
I would suggest to put your project up on github and tell us which file you are running. There is nothing wrong with the interpreter. It is something you are doing.
Notice Py1 is a folder, not a file. Maybe I try something impossible. So in case I have many projects, I cannot tell python "run this project". As for Github, even if I am on Atom, it is very complicated for me to use Github.
(Mar-04-2018, 09:01 PM)sylas Wrote: [ -> ]Notice Py1 is a folder, not a file.
Python can run a folder if it contains a file
__main__.py
.
Error:
E:\Documents>python Py1
C:\Program Files\Python36\python.exe: can't find '__main__' module in 'Py1'
E:\Documents>
Is there a file named "__main__.py" in Py1? don't forget the double underscores on each side of the word 'main'.