From: Luis M. G. <lu...@gm...> - 2004-06-28 00:37:22
|
Hi everyone! I have the a problem with the Save file dialog. What I try to do is serializing a dictionary containing objects with the Cpickle module. The name and path of the file should be those entered into the "save file" dialog, which I created as follows: def on_save_mouseClick(self, event): aStyle = dialog.FILE_SAVE | dialog.FILE_HIDE_READONLY | dialog.FILE_OVERWRITE_PROMPT result = dialog.fileDialog(self, 'Save', '', '', "*.data", aStyle) myfile= result['paths'] import cPickle f = file(myfile, 'w') cPickle.dump(student.students, f) f.close() However, when I try to save a file I get is the following error message: Traceback (most recent call last): File "C:\Python23\lib\site-packages\PythonCardPrototype\components\button.py", line 144, in _dispatch component._notifyEventListeners(evt) File "C:\Python23\lib\site-packages\PythonCardPrototype\event.py", line 334, in _notifyEventListeners listener.eventOccurred( event ) File "C:\Python23\lib\site-packages\PythonCardPrototype\dispatch.py", line 83, in eventOccurred handler.getFunction()(self._scriptable, nativeEvent) File "C:\Documents and Settings\Usuario1\Escritorio\misApps\Grades\kkk.pyw", line 142, in on_save_mouseClick f = file(myfile, 'w') TypeError: coercing to Unicode: need string or buffer, list found What am I doing wrong? |