os.mknod returns [error38] function not implemented in google colab

932 Views Asked by At

I am trying to run the following piece of code on google colab.

dir_path = '/content/drive/My Drive/Colab Notebooks'
log_loss_path =os.path.join(dir_path, 'log_loss.txt')
if not os.path.isfile(log_loss_path):
    os.mknod(log_loss_path)

but i get the error [Errno 38] Function not implemented

    OSError                                   Traceback (most recent call last)
<ipython-input-15-bd3880e6bb8b> in <module>()
      2 log_loss_path = os.path.join(dir_path, 'log_loss.txt')
      3 if not os.path.isfile(log_loss_path):
----> 4     os.mknod(log_loss_path)

OSError: [Errno 38] Function not implemented

can anyone help to solve it?

1

There are 1 best solutions below

0
Bob Smith On BEST ANSWER

/content/drive is a FUSE filesystem which doesn't support this operation.

If you are just trying to create a file, use instead open(log_loss_path, 'w').