I m using fileDialog(self, message, path, filename, filter, aStyle(opotional)) 
to save the file. 
In my code, i used fileDialog to show save dialog box and when we click on save 
button, it should save that file which is of txt type (filter = '*.txt'). But 
when we click on save button it returns error: "coercing to unicode: need 
string or buffer, list found" rather than saving / creating a file. I also 
tried f = file(myfile, 'w', 1000) instead of f = file(myfile, 'w'), where 1000 
is buffer size, but both have the same error. where as if we use 




file(
filename[, mode[, bufsize]])
, then it creates a file of specified type. But it is not working in 
fileDialog(). Why?Where i m wrong?
 
What should i do?
 
Following is my code:
def on_btn2_mouseClick(self, event):        aStyle = 
wx.SAVE|wx.HIDE_READONLY|wx.OVERWRITE_PROMPT        filter = '*.txt'
        result = dialog.fileDialog(self, 'ist def', '', 'n', wildcard, aStyle)  
      myfile= result.paths        if result.accepted == True :            f = 
file(myfile, 'w')            f.write('my file')            f.close()
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to