Probs with classes: cannot instantiate

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


In article <20001230.23424514 at snafu.btx.dtag.de>,
Markus Vogl  <vogl at mavo.de> wrote:
>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()
>
>The error messages:
>	x = DirParser()
>...
>TypeError: call of non-function ( type module )

You want x = DirParser.DirParser()

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





More information about the Python-list mailing list