zaheer.ag...@gmail.com schrieb:
Hi,
I have the following declared in my class, I am trying tp call a
method defined in the same class
I am not sure why I am getting name not defined error
if options.uploadFile != None :
print "This is path", the_rest
filePath = the_rest
UploadFile(None,filePath)
def UploadFile(self,path):
print "I wil upload now"
os.chdir(homeFolder)
config = ConfigParser.ConfigParser()
.....
any ideas why the error name UploadFile not defined
Because you need to define things *before* you use them the first time.
This is not to be confused with forward-declarations, as they are needed
in C for example - in python you can do
def foo():
bar()
def bar():
foo()
(resulting in an endless loop of course)
But you can't do
def foo():
bar()
foo() # this will fail
def bar():
foo()
Diez
--
http://mail.python.org/mailman/listinfo/python-list