After importing the script below as as
>>import g4
followed by

>>> pad ="ram:t/list.lha"
>>> g4.extract(pad,"path")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "", line 52, in extract
return takeaction.get(itemnw,errhandler)(fromvar)
TypeError: errhandler() takes no arguments (1 given)

This error does not appear when i use the last line (commented out here, instead orf the previous active one. Can you help me?

def doClean(fromvar): print "doClean", fromvar 
def doUnquote(fromvar): print "doUnquote", fromvar 
def doRoot(fromvar): print "doRoot",fromvar 
def doPath(fromvar): return os.path.dirname(fromvar)
def doFile(fromvar): return os.path.basename(fromvar)
def doExt(fromvar): return os.path.splitext(fromvar)[1]

def errhandler ():
   print "Your input has not been recognised"

# set up a dictionary of actions

def extract(fromvar,item):

   takeaction = {
      "root": doRoot,
      "path": doPath,
      "clean": doClean,
      "file": doFile}

   # print takeaction.get(item,errhandler) # ok => [<function doClean at 0x574f4a70>, 'please help me']
   #print fromvar.lower
   itemnw = item.lower

   return takeaction.get(itemnw,errhandler)(fromvar)

   #return takeaction.get(item,errhandler)(fromvar)
This question has already been answered. Start a new discussion instead.