B
Bigbowser
Hi all,
I'm trying to create a sub shell environment ( i
haven't really got a reason, its more of a test,
although hopefully it will make life easier ;P )
but whenever i try to call the commands i've created
i get :
[ ice being the sub-shells name ]
ICE> help
Traceback (most recent call last):
File "./console.py", line 27, in ?
for cmd, callback in cmds:
ValueError: too many values to unpack
the code that is supposed to parse out the commands :
( all the commands are in a seperate file called
commands.py, just for ease of maintance and
readability )
---begin----
import commands
userInput = str()
while(1):
userInput == raw_input('ICE> ')
cmds = { 'help' : commands.displayHelp, 'version' :
commands.displayVersion,
'authors' : commands.displayAuthors, 'exit' :
commands.exitIce}
for cmd, callback in cmds:
if userInput == cmd:
callback()
-----end------
I've tried several methods of going around this error,
but none seem to work, the only other way i could do
it is with a big series of if and elif statments ..
but i don't reall want to for maintanance reasons ..
if i print cmds ( the array that holds the commands )
:
{'version': <function displayVersion at 0x403db17c>,
'exit': <function exitIce at 0x403dbc6c>, 'help':
<function displayHelp at 0x403d6f44>, 'authors':
<function displayAuthors at 0x403dbc34>}
Thanks
Bigbowser
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
I'm trying to create a sub shell environment ( i
haven't really got a reason, its more of a test,
although hopefully it will make life easier ;P )
but whenever i try to call the commands i've created
i get :
[ ice being the sub-shells name ]
ICE> help
Traceback (most recent call last):
File "./console.py", line 27, in ?
for cmd, callback in cmds:
ValueError: too many values to unpack
the code that is supposed to parse out the commands :
( all the commands are in a seperate file called
commands.py, just for ease of maintance and
readability )
---begin----
import commands
userInput = str()
while(1):
userInput == raw_input('ICE> ')
cmds = { 'help' : commands.displayHelp, 'version' :
commands.displayVersion,
'authors' : commands.displayAuthors, 'exit' :
commands.exitIce}
for cmd, callback in cmds:
if userInput == cmd:
callback()
-----end------
I've tried several methods of going around this error,
but none seem to work, the only other way i could do
it is with a big series of if and elif statments ..
but i don't reall want to for maintanance reasons ..
if i print cmds ( the array that holds the commands )
:
{'version': <function displayVersion at 0x403db17c>,
'exit': <function exitIce at 0x403dbc6c>, 'help':
<function displayHelp at 0x403d6f44>, 'authors':
<function displayAuthors at 0x403dbc34>}
Thanks
Bigbowser
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail