Hi

I am trying to do something like this:

#!/usr/bin/env python
def command_dispatcher():
        "Takes comman line arguments and executes regardin method"
        command = raw_input(">>>")
        args = command.split(" ")
        args[0].args[1]
class calculate:
        def bundle(self):
                print __class__
command_dispatcher()

What I need this to do is, take a raw input, split it into parts and execute class args[0] and method args[1] using args[2:] as an argument. But what I have done isn't working. This is the error I get:

:!/home/yasar/best_buy/main.py
>>>calculate bundle
Traceback (most recent call last):
  File "/home/yasar/best_buy/main.py", line 10, in <module>
    command_dispatcher()
  File "/home/yasar/best_buy/main.py", line 6, in command_dispatcher
    args[0].args[1]
AttributeError: 'str' object has no attribute 'args'

shell returned 1

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to