# Can't get a .jl file to read a .jdl2 file in the same route folder

**URL:** <https://discourse.julialang.org/t/cant-get-a-jl-file-to-read-a-jdl2-file-in-the-same-route-folder/126639>\
**Category:** New to Julia\
**Created:** [March 6, 2025, 2:05pm UTC](https://discourse.julialang.org/t/cant-get-a-jl-file-to-read-a-jdl2-file-in-the-same-route-folder/126639 "2025-03-06T14:05:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjm10](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sjm10/32/215638_2.png) [@sjm10](https://discourse.julialang.org/u/sjm10)\
**Post date:** [March 6, 2025, 2:05pm UTC](https://discourse.julialang.org/t/cant-get-a-jl-file-to-read-a-jdl2-file-in-the-same-route-folder/126639/1 "2025-03-06T14:05:26Z")

</div>

When running a file I get the following error:

ERROR: LoadError: ArgumentError: No file exists at given path: Datasets.jld2

I have tried loading the file from its own route first but doesn’t seem to help. The datasets file is in the same folder as the main .jl file and I’m not sure how to get it to read it.

I’m sure I’m missing something obvious but can’t for the life of me figure out what or see an existing thread with the same problem.

Thanks

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [March 6, 2025, 2:18pm UTC](https://discourse.julialang.org/t/cant-get-a-jl-file-to-read-a-jdl2-file-in-the-same-route-folder/126639/2 "2025-03-06T14:18:43Z")

</div>

Julia’s working directory may be different from the file it’s executing. One easy solution here is to use the special `@ __DIR__ ` macro to ensure the path is resolved relative to the Julia file:

```julia
JLD2.open(joinpath(@ __DIR__ , "Datasets.jld2"))

```

---

<div class="post-metadata">

**Author:** ![sjm10](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sjm10/32/215638_2.png) [@sjm10](https://discourse.julialang.org/u/sjm10)\
**Post date:** [March 6, 2025, 2:38pm UTC](https://discourse.julialang.org/t/cant-get-a-jl-file-to-read-a-jdl2-file-in-the-same-route-folder/126639/3 "2025-03-06T14:38:41Z")

</div>

Does this need to be included in the main .jl file or can it be run prior to executing the main project?

---

<div class="post-metadata">

**Author:** ![sjm10](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sjm10/32/215638_2.png) [@sjm10](https://discourse.julialang.org/u/sjm10)\
**Post date:** [March 6, 2025, 3:00pm UTC](https://discourse.julialang.org/t/cant-get-a-jl-file-to-read-a-jdl2-file-in-the-same-route-folder/126639/4 "2025-03-06T15:00:03Z")

</div>

I’ve resolved it via the cd(“path/to/dataset”) function. Didn’t know that julia’s base directory is that of the machine
