Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'output': 0.04; 'error:': 0.05; 'subject:help': 0.07; '"w")': 0.09; 'explanation': 0.09; 'ioerror:': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rows': 0.09; 'stored': 0.10; 'advance': 0.10; 'csv': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'slashes.': 0.16; 'writer': 0.16; 'string': 0.17; 'wrote:': 0.17; 'skip:g 40': 0.17; 'subject:need': 0.17; 'skip:" 40': 0.20; 'import': 0.21; "skip:' 40": 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(most': 0.27; 'raw': 0.27; 'merge': 0.27; 'header:X -Complaints-To:1': 0.28; 'folder': 0.30; 'mode': 0.30; 'subject: : ': 0.30; 'url:python': 0.32; 'file': 0.32; 'from:addr:yahoo.co.uk': 0.32; 'traceback': 0.33; 'to:addr:python- list': 0.33; 'thanks': 0.34; 'received:org': 0.36; 'url:org': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'files': 0.38; 'url:docs': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'back': 0.62; 'here': 0.65; 'forward': 0.66; 'programme': 0.69; 'url:reference': 0.84; 'subject:urgent': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: IOerror : need urgent help Date: Tue, 19 Feb 2013 15:49:18 +0000 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-92-22-84-96.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: X-Antivirus: avast! (VPS 130219-0, 19/02/2013), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361288958 news.xs4all.nl 6942 [2001:888:2000:d::a6]:40650 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39235 On 19/02/2013 15:27, inshu chauhan wrote: > 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 > 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 !! > Use a raw string for the output file name or forward instead of back slashes. Explanation here http://docs.python.org/2/reference/lexical_analysis.html -- Cheers. Mark Lawrence