Probs with classes: cannot instantiate

Kragen Sitaker kragen at
Sun Dec 31 00:04:27 CET 2000

In article <20001230.23424514 at>,
Markus Vogl  <vogl at> wrote:
>This is the file [] stuff:
>class DirParser:
>	def display(self):
>		print "This is the display method."
>To test this i use in the same directory [which is in 
>import DirParser
>x = DirParser()
>The error messages:
>	x = DirParser()
>TypeError: call of non-function ( type module )

You want x = DirParser.DirParser()

Or possibly you should call the file and say 
"from dp import DirParser" instead of "import dp".
<kragen at>       Kragen Sitaker     <>
Perilous to all of us are the devices of an art deeper than we possess
       -- Gandalf the White [J.R.R. Tolkien, "The Two Towers", Bk 3, Ch. XI]

More information about the Python-list mailing list