Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'configure': 0.05; 'subject:Python': 0.06; 'filename': 0.09; 'ide': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'runs': 0.10; '.py': 0.16; 'code?': 0.16; 'csv': 0.16; 'kern': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'relevant.': 0.16; 'script,': 0.16; "subject:'.": 0.16; 'subject:File': 0.16; 'subject:exists': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'saying': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'directory.': 0.24; 'exists': 0.24; 'interpret': 0.24; 'file.': 0.24; 'script': 0.25; 'skip:" 30': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'robert': 0.30; "i'm": 0.30; 'gives': 0.31; 'code': 0.31; 'file': 0.32; 'this.': 0.32; 'thanks!': 0.32; 'run': 0.32; 'running': 0.33; '(most': 0.33; 'something': 0.35; 'in.': 0.36; 'doing': 0.36; 'example,': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'recent': 0.39; 'expect': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'how': 0.40; 'email addr:gmail.com': 0.63; 'our': 0.64; 'pick': 0.64; 'world': 0.66; 'believe': 0.68; 'reads': 0.68; 'eco': 0.84; 'terrible': 0.84; 'subject:found': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: File exists but Python says 'not found'. Date: Mon, 01 Jul 2013 11:56:38 +0100 References: <5c1d1e47-b67e-4bce-8601-b14c0215f450@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 213.1.240.226 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: <5c1d1e47-b67e-4bce-8601-b14c0215f450@googlegroups.com> 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372676220 news.xs4all.nl 16004 [2001:888:2000:d::a6]:51974 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49545 On 2013-07-01 11:47, prerit86@gmail.com wrote: > I'm running this code that reads 2 csv files (one of them is train.csv). The code gives an error saying 'file not does not exist'. However, the file does exists in the same location as the .py file. Can someone please help me on this. Thanks! How are you running the code? If you are doing pandas.read_csv('train.csv'), the file must be in the current working directory of the running process. The location of the .py file contain the code is not relevant. For example, if you are using an IDE to run the script, you may need to configure how it runs the script to pick a particular directory for it to run in. > Code Output--> > > Reading dataset... > Traceback (most recent call last): > File "c:\Project_1\regression_2.py", line 163, in > main(**args) > File "c:\Project_1\regression_2.py", line 80, in main > train_data = pd.read_csv(train) Since the filename of regression_2.py in the traceback is fully-qualified, I expect that you are running the program from something other than the c:\Project_1\ directory. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco