Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39234 > unrolled thread

Re: IOerror : need urgent help

Started byThomas Calmant <thomas.calmant@gmail.com>
First post2013-02-19 16:40 +0100
Last post2013-02-19 16:40 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: IOerror : need urgent help Thomas Calmant <thomas.calmant@gmail.com> - 2013-02-19 16:40 +0100

#39234 — Re: IOerror : need urgent help

FromThomas Calmant <thomas.calmant@gmail.com>
Date2013-02-19 16:40 +0100
SubjectRe: IOerror : need urgent help
Message-ID<mailman.2033.1361288468.2939.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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@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
>
>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web