Python script executed twice with Eclipse PyDev -
I have a project named Architecture, which is used in eclipse PyDev, with the following architecture:
automated_vertica src Root __init__.py RequestHandler.py RequestHandler.py is a module which is a bunch of methods and nothing else.
__init __. There are just two lines in py : requestHandler print ('test') from the root import When I __ init __ . PyDev runs PyLev Eclipse console test twice if I remove the root from , then it works fine. Can you please tell me what I am remembering and what is happening here?
Edit: Content on April 23, 2014 @ author: myname '' 'def fileTostring (filename): F = Open (filename,' R ') result = F is created.
__init __ file as the root , this There is a module. When you run a , from module import , it executes any code in that module __init __ . And since your __init __ contains in , which is executed. Because you are running __init __ (which you should not be bitten), it is doing the following: <; & Gt -> Pre-Root Import Request from Handler - & gt; Root .__ init__: - & gt; Import Request Handle - & gt; Print ("Test") - & gt; Print ("Test") __ init __ is useful for testing any module, or fallback, or python version. __init __. Py will not import less than 400 modules to any version of Python:
import sys If not, then (sys, "version_info") or sys.version_info & lt; (400, 0): Increase RuntimeError ("Root requires Python 400.0 or later.") Root order request Handler print ("Test") Dell system Let's hope It is time that
Comments
Post a Comment