Alex Ezell wrote: > On 10/24/07, Kent Johnson <[EMAIL PROTECTED]> wrote: >> Alex Ezell wrote: >>> I am working on building a SOAP client. Unfortunately, one of the >>> methods the SOAP server provides is named "import." The SOAP server is >>> written in PHP. >>> >>> So, my problem is that Python really doesn't like me using the word >>> "import" to call the SOAP method. The call should look something like >>> this: >>> >>> self.call_response = self.soap.import(self.soap_auth, file_name, >>> import_groups, soap_flags) >>> >>> Is there any way to call this method despite it's name being a reserved >>> word. >> You could try introspection: >> >> importFunc = getattr(self.soap, 'import') >> self.call_response = importFunc(self.soap_auth, file_name, >> import_groups, soap_flags) > > Thanks Kent. I tried it and it seem like importFunc is now something > like 'import.__str__'. I could maybe do some string operations to just > get import out of that, but is there something I could do with > getattr() for that reference to come back the way I need.
Hmm, with a quick look at the code for SOAPpy (v 0.11.6) I don't see why the getattr() method would not work. Can you show the code you tried and why you think the result was a string? BTW pulling 'import' out of the string won't help; you need the import *function*. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor