HI; I am having the following error:
AttributeError: 'str' object has no attribute 'pop' am using Python 2.3.4 and am importing the following libraries: import sys, os, inspect from Asterisk import Manager, BaseException, Config import Asterisk.Util The code being executed is: if command not in commands: raise ArgumentsError('invalid arguments.') if command == 'usage': return usage(argv[0], sys.stdout) manager = Manager.Manager(*Config.Config().get_connection()) if command == 'actions': show_actions() if command == 'help': if len(argv) < 3: raise ArgumentsError('please specify an action.') show_actions(argv[2]) elif command == 'action': if len(argv) < 3: raise ArgumentsError('please specify an action.') try: execute_action(manager, argv[2:]) except TypeError, e: print "Bad arguments specified. Help for %s:" % (argv[2],) show_actions(argv[2]) elif command == 'command': execute_action('command', argv[2]) def execute_action(manager, argv): method_name = argv.pop(0).lower() but i always thought that something like this will be standard stuff. Any ideas? Mike Meyer wrote: >"M.N.A.Smadi" <[EMAIL PROTECTED]> writes: > > > >>HI; >> >>I am having the following error. I am using someone else's code and >>all they are doing is pass an argv to a function then >> >>def execute_action(manager, argv): >> method_name = argv.pop(0).lower() >> >> >>and am getting this strange error. >>AttributeError: 'str' object has no attribute 'pop' >> >>am using Python 2.3.4 and am importing the following libraries: >> >>import sys, os, inspect >>from Asterisk import Manager, BaseException, Config >>import Asterisk.Util >> >>but i always thought that something like this will be standard stuff. >>Any ideas? >> >> > >Yes - show us the rest of the code. execute_action is never called in >the snippets you posted, and it's pretty clear that it's being invoked >with the wrong thing as an argument. Can you provide a minimal working >(well, executable) code sample that generates the error message you >are getting? > >Oh yeah - post the full traceback as well. > > <mike > > > -- http://mail.python.org/mailman/listinfo/python-list