FileNotFoundError after I used

I am trying to use to get multiple trials for my experiment. But after I used the, I got a FileNotFoundError like below:

Traceback (most recent call last):
File"/Users/zhaopengqian/miniconda3/envs/flow/lib/python3.7/sitepackages/ray/tune/", line 248, in run
File"/Users/zhaopengqian/miniconda3/envs/flow/lib/python3.7/sitepackages/ray/tune/", line 316, in entrypoint
File"/Users/zhaopengqian/miniconda3/envs/flow/lib/python3.7/sitepackages/ray/tune/", line 580, in _trainable_func
output = fn()
File “/Users/zhaopengqian/Desktop/Experiment/deeprl_signal_control的/”, line 218, in train_config
dirs = init_dir(base_dir)
File “/Users/zhaopengqian/Desktop/Experiment/deeprl_signal_contro的/”, line 34, in init_dir
FileNotFoundError: [Errno 2] No such file or directory: ‘results/ma2c_1’

And the like below which is just to create a directory and file:

if not os.path.exists(base_dir):

When I put this part before the propram operate correct. So, is the change the os.path so that it can`t find the correct path?
How can i fix it?

Hey @Qian_Zhao, yes that’s right, the Ray Tune trials are not run in the same working directory as the driver.

You have a couple options here:

  1. Use absolute paths instead of relative paths inside your training function/trainable
  2. Starting from Ray 1.12, inside your training function/Trainable, you can access the original working dir via the TUNE_ORIG_WORKING_DIR environment variable. So you can change to this directory inside the training function, but it is recommended to do so for read-only purposes.

Thank you very much! I solved this problem by using the absolute paths.