0

I'm trying run a python script in Eclipse 3.8.1 but I keep getting the error message:

IOError: [Errno 2] No such file or directory 

The problem occurs in a code line:

train_labels = np.loadtxt("./examples/data/class_train.labels")

Here is a screenshot of my project:

enter image description here

It seems the relative path starts from the location of the script itself, whereas I would want the relative path start from the root directory of the project, that is the RLScore-folder as you can see in the image.

How do I configure this?

P.S. I wouldn't want to edit the code, because this is not my own code and I would need to do the editing into many other files in the distribution.

jjepsuomi
  • 4,223
  • 8
  • 46
  • 74

1 Answers1

1

try :

train_labels = np.loadtxt("../data/class_train.labels")
flafoux
  • 2,080
  • 1
  • 12
  • 13
  • Hi @flafoux thank you for your help :) But I don't want to edit the code, the reason is because this is not my own code and editing the code would mean I would need to edit the lines into many many other files. Is it possible to simply set where the relative seach path start from? – jjepsuomi May 28 '15 at 11:17
  • sorry, misread some part of your question... I don't know if that's possible.. do you have any related option in `preference` or in `run configuration` ? like a working directory or execution directory – flafoux May 28 '15 at 11:20
  • If I go to `run configurations` --> `Arguments` I have `working directory ` set to `${workspace_loc:RLScore/examples/code}` . – jjepsuomi May 28 '15 at 11:23
  • P.S. I googled and found this https://bugs.eclipse.org/bugs/show_bug.cgi?id=301527. It seems there is a default working directory, but it can't be changed apparently :/ See http://stackoverflow.com/questions/981213/default-eclipse-working-directory – jjepsuomi May 28 '15 at 11:31