google app engine - How to load module with same name as other module in Python? -


Let me explain the problem - we have such a project:

  model / __ init__ How to load in the .py model /abstract.py function / __ init__.pywork / model.py  

work / model.py model. Abstract What is the syntax for this? # work / model_ype model # this model does not load model / model.py. Abstract Import Test # There is no test exception.

  #model / abstract.py test = 1  

How to import such?


More information requested.

Google App Engine Application: - The main is main.py

Directory structure:

  └───src │ app.yaml │ index Yaml │ main.html │ main │ task_master_api.py │ ├─── circle │ model.py │ __init__.py │model │ abstract.py │ xxx.py │ __init__.py │Tatsk │ model py │ __init__.py │ ├─── ├─── │ model model │ __init__.py  

exception (see work is not rooted in model model):

  from .. import model logging. Critical (model (model), Model .__ name__) Model. Abstract Import AbstractNamed, AbstractForgetable  
  CRITICAL 2014-02- Model 212: 23: 36,828 Model. Py: 8] (& lt; type 'module' & gt;, 'Model.abstract abstract.Name from Import, AbstractForgetable ImportError: any module abstract  
< Hr>

is more related to the answer.

Model

from

 .  
  Value error: Attempted relative import related to incomplete package  

While ndpu Barley The relative import work should be done at ARB, answ this question which is burning in my mind is just that: Rename your files to avoid this error .

If you have the model.py inside the circle directory, how about changing the name to circle_model.py ?

Then, should be able to import the module without relative import. Business.

Edit - Now to know that you do not want to change your name

Be sure that you have a __ init __.py < / Code> The file is from your src directory, then relative import from .model.abstract import test


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -