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


Groups > comp.lang.python > #49545

Re: File exists but Python says 'not found'.

From Robert Kern <robert.kern@gmail.com>
Subject Re: File exists but Python says 'not found'.
Date 2013-07-01 11:56 +0100
References <5c1d1e47-b67e-4bce-8601-b14c0215f450@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4062.1372676220.3114.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

File exists but Python says 'not found'. prerit86@gmail.com - 2013-07-01 03:47 -0700
  Re: File exists but Python says 'not found'. Robert Kern <robert.kern@gmail.com> - 2013-07-01 11:56 +0100
  Re: File exists but Python says 'not found'. prerit86@gmail.com - 2013-07-01 03:57 -0700
    Re: File exists but Python says 'not found'. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-07-01 13:15 +0200
      Re: File exists but Python says 'not found'. prerit86@gmail.com - 2013-07-01 04:32 -0700
  Re: File exists but Python says 'not found'. Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-07-01 12:59 +0200
    Re: File exists but Python says 'not found'. prerit86@gmail.com - 2013-07-01 04:00 -0700
      Re: File exists but Python says 'not found'. Dave Angel <davea@davea.name> - 2013-07-01 07:38 -0400
        Re: File exists but Python says 'not found'. prerit86@gmail.com - 2013-07-01 05:17 -0700

csiph-web