Read Files across File Systems (PyCharm Windows/WSL)

Question:

I’m using PyCharm with a WSL interpreter because I need to use a library that doesn’t work well with Windows (gtsam, if you’re wondering).

I have a pandas Dataframe stored as a pickle file on my "regular" workspace, e.g. "C:somewindowspathtofile.pkl", and I want to read it in my WSL-PyCharm environment.

Obviously I can copy the file to my WSL machine and read it from its new path.
However I’m hoping for a "cleaner" solution that doesn’t involve making multiple copies of huge pkl files.

Any ideas?

Asked By: Jon Nir

||

Answers:

By default, WSL should mount your C: drive at /mnt/c, so you should be able to access your file as /mnt/c/some/windows/path/to/file.pkl.

Answered By: Althorion

For folks searching for a way to open WSL-only locations, like ~, in Pycharm:

  1. In Pycharm go to menu File / Open...
  2. \wsl$Ubuntu location should be available in the locations list (assuming Ubuntu is used). Just select /home/<your_username>
Answered By: ellockie