[Tutor] create an xls file using data from a txt file

tee chwee liong tcl76 at hotmail.com
Thu May 12 04:51:11 CEST 2011


excellent it works. tq
 


Date: Wed, 11 May 2011 14:58:39 +0100
Subject: Re: [Tutor] create an xls file using data from a txt file
From: wprins at gmail.com
To: tcl76 at hotmail.com
CC: taxbotsis at gmail.com; tutor at python.org




On 11 May 2011 14:34, tee chwee liong <tcl76 at hotmail.com> wrote:


hi all, 
 
thanks for this sharing. when i copy and run this code, i got this error:
 
Traceback (most recent call last):
  File "C:/Python25/myscript/excel/sampleexcel.py", line 1, in <module>
    import csv
  File "C:/Python25/myscript/excel\csv.py", line 3, in <module>
    w=csv.writer(open('output.csv','w'))
AttributeError: 'module' object has no attribute 'writer'



Well, reading the error message, it's saying that module "csv", coming from file "C:/Python25/myscript/excel\
csv.py" has no member "writer".  So, it seems you've called your test script (module) "csv" which effecitvely hid the standard python "csv" module.  

Try renaming your script file to something else ('testcsv.py' maybe) so its name doesn't conflict with the standard "csv" module and try again.

Walter
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110512/2ce60766/attachment.html>


More information about the Tutor mailing list