On 07/01/2013 07:00 AM, preri...@gmail.com wrote:
I got it. The working directory was different. Sorry, I'm new and didn't the working directory has to be the location of the data. I thought the location of .py file and data file should be same. Thanks! Es. Robert Kern.
Python didn't make that assumption, the author of the script did. By using a relative name like train.csv, he is implicitly forcing Python to use the current working directory.
If he had wanted the file to be found in the same directory as one of the source files, he could have built an absolute path by using the __file__ attribute of the module.
However, for non-const files, the source directory is generally a bad place to put them.
Confounding things is the strange habit that Windows has of deciding that the script location *should* be your current directory. I believe Explorer does that if you right-click select a script.
-- DaveA -- http://mail.python.org/mailman/listinfo/python-list