title: FileNotFoundError despite file existing
body: <p>This is the function that uses a file to return some parameters</p>
  <pre><code>def load_network_params(agent_name: str, env_name: str,
                          network_root_folder: str = 'jax-models') -&gt; flax.core.FrozenDict:
  
      filePathString=network_root_folder+r&quot;/&quot;+agent_name+r&quot;/&quot;+env_name+r&quot;/2&quot;
      fileNameStr=r&quot;ckpt.199&quot;
      fileString=os.path.join(filePathString,fileNameStr)
      with open(fileString, 'rb') as file:
       # file processing irrelevant to error
          })
      return network_params
  </code></pre>
  <p>This is the way the function was subsequently used:</p>
  <pre><code>from dataset import *
  generate_dataset(r&quot;dqn&quot;, r&quot;Breakout&quot;, 10_000, network_root_folder=r&quot;C:/Users/jk5g19/Documents/Year3IP/scripts/jax&quot;)
  </code></pre>
  <p>Edit: Basically the generate_dataset calls load_network_parameter, I tried to cut down the amount of code shared, so that people would get less confused. This is the Minimum Viable product.</p>
  <pre><code>def generate_dataset(agent_name: str, env_name: str, dataset_size: int, num_envs: int = 20, epsilon: float = 0.1,
                       network_root_folder: str = 'jax-models') -&gt; Tuple[onp.ndarray, onp.ndarray, onp.ndarray,
                                                                         onp.ndarray, int]:
  
      num_actions = gym.make(f'{env_name}NoFrameskip-v0').action_space.n
  
      images_obs_dataset = onp.zeros((dataset_size, 84, 84, 4))
      ram_obs_dataset = onp.zeros((dataset_size, 128))
      q_values_dataset = onp.zeros((dataset_size, num_actions))
      action_dataset = onp.zeros(dataset_size)
  
      network_def, network_args = get_network_def(agent_name, num_actions)
      network_params = load_network_params(agent_name, env_name, network_root_folder=network_root_folder)
  
      return images_obs_dataset, ram_obs_dataset, q_values_dataset, action_dataset, episodes_run
  </code></pre>
  <p>When I output the filestring and copy and paste it into the file explorer the desired file can be accessed. I used raw strings for the path and experimented with double back slashes and forward slashes.</p>
  <p>I also added a test.txt file in the path too, the file path did not work hence it rules out the file type causing issues with open().</p>
  <p><a href="https://i.stack.imgur.com/5yXBl.png" rel="nofollow noreferrer">screenshot of error</a></p>