Forum Discussion
Really strange issue - os.listdir
Hi all,
I am also getting some of the same issues as you are decribing here.
I found out that when working with os module and absolute paths(eg: '/lakehouse/default/Files') like 'os.listdir' these exceptions usually occur after uploading some files/folder while running a session with default lakehouse.
What I imagine the issue is that fabric filesystem runs on top of blobfuse2 and the change you do is not imediately reflected to the users mounted filesystem under /lakehouse/default/Files.
The workaround is to use notebookutils.fs module to list dir since this module reflects the changes imediatelly somehow. You can also use this module to read the file content for example: notebookutils.fs.head('Files/filetoread.txt', maxBytes=10000)
or to list files under files directory: notebookutils.fs.ls('Files/')
Still I think this is a bug so the microsoft team should address it.
Hope it helps someone.