Classes, why ? so many problems ?

Graeme Matthew graeme.matthew at unite.com.au
Tue Apr 16 07:01:00 EDT 2002


hi all im really having problems with Python can anyone please tell me why I
cannot run this code, I keep on getting:
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "C:\www\cgi-bin\test.py", line 9, in ?
    template.PrintOut()
AttributeError: Template instance has no attribute 'PrintOut'

class Template:

    def __init__(self):
        self.name = 'Template'

    def PrintOut(self):
        print self.name

Run from:

#! C:\\python22\\python.exe

import sys

sys.path.append('C:\\www\\classes')
import Template

template = Template.Template()
template.PrintOut()
print "done"







More information about the Python-list mailing list