hey guys,
I have just started writing some code in python and have hit a wall on a very basic question.
I basically want to call a function I have written. My code is something like this:
Code:
if __name__ = "__main__"
try:
username = sys.argv[1]
except IndexError:
print "%d" % self.mySyntax()
sys.exit(2)
mySyntax() is a function i have written in the same file and it goes like this:
Code:
def mySyntax(self):
result = blah...blah...blah
return result
When i run this, i get:
Code:
Traceback (most recent call last):
File "./mdirgmail.py", line 37, in ?
print "%d" % self.mySyntax()
NameError: name 'self' is not defined
Can someone please suggest a fix for this.
Thanks