# Error Loading CSV Files using ~/filepath.csv

**URL:** <https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314>\
**Category:** New to Julia\
**Tags:** question, csv, filesystem\
**Created:** [February 12, 2022, 7:32pm UTC](https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314 "2022-02-12T19:32:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srikrishna\_Venkat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/srikrishna_venkat/32/33752_2.png) [@Srikrishna\_Venkat](https://discourse.julialang.org/u/Srikrishna_Venkat)\
**Post date:** [February 12, 2022, 7:32pm UTC](https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314/1 "2022-02-12T19:32:20Z")

</div>

Hi!

I’m new to Julia & don’t understand why when using ‘~’ to specify start of my filepath, FileIO.load() gives a

Load Error:

```julia
using FileIO, CSVFiles, DataFrames

obj1 = load("~/Desktop/solar power by country.csv")

obj1 = load("~/Desktop/solar power by country.csv")
ERROR: LoadError: ArgumentError: No file exists at given path: ~/Desktop/solar power by country.csv
Stacktrace:
 [1] checkpath_load
   @ ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:167 [inlined]
 [2] load(::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:110
 [3] load(::String)
   @ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:110
 [4] top-level scope
   @ Untitled-1:3
in expression starting at Untitled-1:3

```

But neither the ./filepath or absolute path gives that error:

```julia
obj2 = load("./Desktop/solar power by country.csv")
obj3 = load("/home/srikrishna/Desktop/solar power by country.csv")

```

Am I missing something in my understanding? This is in VS code.

In Jupyter ~ automatically turns into /home/srikrishna.

Thanks!

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [February 12, 2022, 8:09pm UTC](https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314/2 "2022-02-12T20:09:15Z")

</div>

> [@Srikrishna\_Venkat](#):
>
> In Jupyter ~

You mean python? Pretty sure Julia (which is the Ju in Jupyter) never expands. One trick is to hit `tab` after typing "~/

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [February 12, 2022, 8:16pm UTC](https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314/3 "2022-02-12T20:16:55Z")

</div>

Or use [`expanduser`](https://docs.julialang.org/en/v1/base/file/#Base.Filesystem.expanduser):

```julia
load(expanduser("~/Desktop/solar power by country.csv"))

```

Other option, use [`homedir`](https://docs.julialang.org/en/v1/base/file/#Base.Filesystem.homedir) to indicate the home:

```julia
load(joinpath(homedir(), "Desktop", "solar power by country.csv"))

```

---

<div class="post-metadata">

**Author:** ![Srikrishna\_Venkat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/srikrishna_venkat/32/33752_2.png) [@Srikrishna\_Venkat](https://discourse.julialang.org/u/Srikrishna_Venkat)\
**Post date:** [February 12, 2022, 9:09pm UTC](https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314/4 "2022-02-12T21:09:31Z")

</div>

Hi!  
Tab complete does work in both REPL & Jupyter for ~.  
But not in VSCode editor 😕

Thanks

---

<div class="post-metadata">

**Author:** ![Srikrishna\_Venkat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/srikrishna_venkat/32/33752_2.png) [@Srikrishna\_Venkat](https://discourse.julialang.org/u/Srikrishna_Venkat)\
**Post date:** [February 12, 2022, 9:13pm UTC](https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314/5 "2022-02-12T21:13:54Z")

</div>

Thanks for the knowledge drop!

---

<div class="post-metadata">

**Author:** ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)\
**Post date:** [February 12, 2022, 10:07pm UTC](https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314/6 "2022-02-12T22:07:32Z")

</div>

~ is supplied by the shell (e.g. Bash), not the operating system

So it is not recognised by System calls as your home directory but as just another filename

Some shells do not provide it e.g. rc from plan9ports

```julia
matt@pox:~$ rc
% ls ~
ls: cannot access '~': No such file or directory
% echo hi > ~
% ls -l
total 608
-rw-r--r-- 1 matt matt 3 Feb 12 22:03 '~'
exit
matt@pox:~$ cat ~
cat: /home/matt: Is a directory
matt@pox:~$ cat "~"
hi
matt@pox:~$

```

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [February 13, 2022, 2:06am UTC](https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314/7 "2022-02-13T02:06:02Z")

</div>

"~/

not

~

![Peek 2022-02-12 21-07](https://global.discourse-cdn.com/julialang/original/3X/4/b/4be5ed25069045e654e381e717573d2bcf791369.gif)

---

<div class="post-metadata">

**Author:** ![Srikrishna\_Venkat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/srikrishna_venkat/32/33752_2.png) [@Srikrishna\_Venkat](https://discourse.julialang.org/u/Srikrishna_Venkat)\
**Post date:** [February 13, 2022, 4:37pm UTC](https://discourse.julialang.org/t/error-loading-csv-files-using-filepath-csv/76314/8 "2022-02-13T16:37:13Z")

</div>

Yes. It works everywhere but the editor pane in VSCode.
