Importing from upper packages

2005-03-01 Thread Henning Kage
I have a library with the following structure:

library
   /app
   /db
   /gui
  /interface.py
  /wx
 /class.py

Each __init__.py file imports the next sub-package. E.g.:

library/__init__.py: 
import app, db, gui

library/gui/__init__.py: 
import wx
from interface import *

library/gui/wx/__init__.py:
from class import *

>From the lowest layer "wx" I need to import an interface defined in the
gui package. Therefore I tried the following in library/gui/wx/class.py:

import library

class ClassTest( libor.gui.Interface):
   pass

I also set the PYTHONPATH to top directory, but I still get an
ImportError. How could this problem be solved or otherwise, how should I
import from upper packages in general? 

Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Importing from upper packages

2005-03-01 Thread Henning Kage
Am Tue, 01 Mar 2005 21:45:17 +0100 schrieb Henning Kage:

> import library
> 
> class ClassTest( libor.gui.Interface):
>pass

Sorry, a small mistake:

class ClassTest( library.gui.Interface):
   pass

-- 
http://mail.python.org/mailman/listinfo/python-list