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

Walter Prins wprins at gmail.com
Wed May 11 15:58:39 CEST 2011


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/20110511/c7946d4a/attachment.html>


More information about the Tutor mailing list