Probs with classes: cannot instantiate

Markus Vogl vogl at mavo.de
Sat Dec 30 18:42:45 EST 2000


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