eclipse - Run Python project from shell -


Eclipse can run a python project instead of just a .py file. Can the whole project be run from Python 3.x shell? I saw it a little bit, but I did not really find any way. I've just tried to run the .py file with the main code in the code exec (open 'bla / blah / projMain.py') like you would file a python All of my modules (including main) are in a package, but when I went to the main section, I got a module 'code' called 'blah' (in the package). Also, as a side note, there is actually a init .py and even pycache 'directory .

Perhaps I have not made it correctly with eclipse (or rather Eclipse did not find it properly), but eclipse can run it, so I have a python with a 3.4.1 shell How can i Do I have to put something in __init __.py , perhaps, and then run that file?

It depends on what your file looks like - if you have then __name__ == "__main__": do_whatever () , then there will be no import do_whatever () because the name of imported module will not be "__ main__" . (It will be the name of this module, whatever it is)

However, if it is just a script without conditional, then you can only import the module and it will be run. Python needs to know where the module is, so if it is not in your way, then you have to use relative import as a document.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -