IOerror : need urgent help

Thomas Calmant thomas.calmant at gmail.com
Tue Feb 19 10:40:50 EST 2013


hi

It seems you forgot to escape the escape character in the file names ('\'):
"C:\Users\inshu.chauhan\Desktop\test.arff"
=> r"C:\Users\inshu.chauhan\Desktop\test.arff"
or
=> "C:\\Users\\inshu.chauhan\\Desktop\\test.arff"

++
Thomas

2013/2/19 inshu chauhan <insideshoes at gmail.com>

> Here is my attempt to merge 10 files stored in a folder into a single file
> :
>
> import csv
>
> with open("C:\Users\inshu.chauhan\Desktop\test.arff", "w") as w:
>     writer = csv.writer(w)
>     for f in glob.glob("C:\Users\inshu.chauhan\Desktop\For
> Model_600\*.arff"):
>         rows = open(f, "r").readlines()
>         writer.writerows(rows)
>
>
> Error:
>
> Traceback (most recent call last):
>   File "C:\Users\inshu.chauhan\Desktop\Mergefiles.py", line 3, in <module>
>     with open("C:\Users\inshu.chauhan\Desktop\test.arff", "w") as w:
> IOError: [Errno 22] invalid mode ('w') or filename:
> 'C:\\Users\\inshu.chauhan\\Desktop\test.arff'
>
> Why my programme is not working ?? :(
>
> Thanks in Advance !!
>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130219/4c75ee65/attachment.html>


More information about the Python-list mailing list