def remove_abs_path(cmd):
 if (cmd and os.path.isabs(cmd[0])):
  cmd = list(cmd)
  cmd[0] = os.path.basename(cmd[0])
 return cmd

def remove_abs_path ( cmd ) : if ( cmd and os . path . isabs ( cmd [ 0 ] ) ) : cmd = list ( cmd ) cmd [ 0 ] = os . path . basename ( cmd [ 0 ] ) return cmd
remove absolute path of executable in cmd note: new instance of list is returned .