Probs with classes: cannot instantiate

Emile van Sebille emile at fenx.com
Sun Dec 31 00:41:09 EST 2000


Looks like you'll want to either:

from DirParser import DirParser

-- or --

x = DirParser.DirParser()

--

Emile van Sebille
emile at fenx.com
-------------------


"Markus Vogl" <vogl at mavo.de> wrote in message
news:20001230.23424514 at snafu.btx.dtag.de...
Hi all!

Sorry for asking a [stupid] question:

Building and instantiating a class in the interpreter works
pretty well.
Nevertheless in the file modus it produces error messages
like:
"call of non function"

Example:

This is the interpreter stuff:
[d:\]python
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)]
on win32
>>> class DirParser:
...     def display(self):
...             print "This is the display method!"
...
>>> x = DirParser()
>>> x.display()
This is the display method!
>>>

This is the file [ DirParser.py] stuff:
class DirParser:
def display(self):
print "This is the display method."

To test this i use classtester.py in the same directory
[which is in
path]:

import DirParser
x = DirParser()
x.display()

The error messages:
x = DirParser()
...
TypeError: call of non-function ( type module )
...

Any help will be appreciated!!
Thank you!!!

TIA
Markus

















More information about the Python-list mailing list