Colab file reading issues

Dear Folks - I am having trouble accessing files in colab after succesfully mounting my google drive

All of the following work :
drive.mount(‘/content/gdrive’, force_remount=True)
%cd gdrive/MyDrive
%ls TriangulationSimulation\ SNOP
file1 = ‘TriangulationSimulation\ SNOP/nlog-dump-SNOP-json-950-0.json’
%cat $file1

However I next try to open the very same file (file1) which is a json file :

fsnop = open(file1)
(or fsnop = open(file1, “r”))

and I get an error : 'FileNotFoundError: [Errno 2] No such file or directory: ‘TriangulationSimulation\ SNOP/nlog-dump-SNOP-json-950-0.json’

My next step will be to load the json data by doing json.load(fsnop)

This works when I run it in python on my laptop so I’ve no idea whats going on.

Farrukh

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.