Importing problems

Gabriele *darkbard* Farina darkbard at gmail.com
Sat Nov 6 15:53:02 CET 2004


Hi

I've my application filesystem structured like this:

app/
-main.py
-pharaon/
--__init__.py
--engine/
---__init__.py
---php/
----__init__.py
----tokenizer.py
--utils
---__init__.py
---buffers.py


I'd like to use a class defined in the module pharaon/utils/buffers.py
inside a class defined in pharaon/engine/php/tokenizer.py

I import the class this way (inside buffers.py):
from pharaon.utils.buffers import FileBuffer

and then I use the class this way:
class Tokenizer:
def __init__(self, source):
self.buffer = FileBuffer(source)

inside the main.py file I got this code:
from pharaon.engine.php.tokenizer import Tokenizer
t = Tokenizer("test.php")
print t.buffer

but when I run the code it prints None.
why?? I wrong importing the modules?? 

bye




More information about the Python-list mailing list