Importing problems

  • Thread starter Gabriele *darkbard* Farina
  • Start date
G

Gabriele *darkbard* Farina

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
 
T

Thomas Guettler

Am Sat, 06 Nov 2004 06:53:02 -0800 schrieb Gabriele *darkbard* Farina:
Hi

I've my application filesystem structured like this:

....
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)

The indentation got lost.
In 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??

What does this print?
print t.buffer.__class__

HTH,
Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top