Hi, this is the line that breaks your code:
def progressTable(progress_table, action, task, pid=len(progress_table) your parameter progress_table is known inside the function, not inside its definition. So "pid=len(progress_table)" won't do. If you really think that it is possible that pid is anything else but "len(progress_table)", you should use for example -1 as the default value and calculate the length inside your functions if the parameter is not different. Otherwise dump this parameter. Hope that helps! Greetings Nils -------- Original-Nachricht -------- Datum: 21 Dec 2006 09:16:58 +1100 Von: Pyenos <[EMAIL PROTECTED]> An: python-list@python.org Betreff: what is wrong with my code? > import cPickle, shelve > > could someone tell me what things are wrong with my code? > > class progress: > > PROGRESS_TABLE_ACTIONS=["new","remove","modify"] > DEFAULT_PROGRESS_DATA_FILE="progress_data" > PROGRESS_OUTCOMES=["pass", "fail"] > > > def unpickleProgressTable(pickled_progress_data_file): > > return unpickled_progress_table > > def pickleProgressTable(progress_table_to_pickle): > > return pickled_progress_data_file > > # Of course, you get progress_table is unpickled progress table. > def progressTable(progress_table, action, task, > pid=len(progress_table), outcome=PROGRESS_OUTCOMES[1]): > pid_column_list=progress_table[0] > task_column_list=progress_table[1] > outcome_column_list=progress_table[2] > > # But a task must also come with an outcome! > def newEntry(new_task, new_outcome): > new_pid=len(task_column_list) > > pid_column_list.extend(new_pid) > task_column_list.extend(new_task) > outcome_column_list.extend(new_outcome) > > def removeEntry(pid_to_remove, task_to_remove): > > if > pid_column_list.index(pid_to_remove)==task_column_list.index(task_to_remove): > # Must remove all columns for that task > index_for_removal=pid_column_list.index(pid_to_remove) > > pid_column_list.remove(index_for_removal) > task_column_list.remove(index_for_removal) > outcome_column_list.remove(index_for_removal) > > # Default action is to modify to pass > def modifyEntry(pid_to_modify, > outcome_to_modify=PROGRESS_OUTCOMES[0]): > index_for_modifying=pid_column_list.index(pid_to_modify) > > # Modify the outcome > outcome_column_list[index_for_modifying]=outcome_to_modify > -- > http://mail.python.org/mailman/listinfo/python-list -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer -- http://mail.python.org/mailman/listinfo/python-list