colab OSError: [Errno 5] Input/output error - python

I am using Google Colaboratory, and mounting Google Drive. When I try to copy a zip file with size 65Gb it gets me the following error:
[Errno 5] Input/output error
I used the below code to copy
%cp /content/drive/My\ Drive/###/data_odometry_gray.zip data_odometry_gray.zip
and also try this
import zipfile
zip_ref = zipfile.ZipFile("/content/drive/My Drive/###/data_odometry_gray.zip", 'r')
zip_ref.extractall("/content/")
zip_ref.close()
but same error

Related

FileNotFoundError: [Errno 2] No such file or directory (python error)

I'm new to python and I'm trying to learn it using Google Colab
I'm trying to open a CSV file, but I just can't do it.
import csv
open(r'C:\Users\User\Desktop\username.csv')
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-30-d948a291431c> in <module>()
1 import csv
----> 2 open(r'C:\Users\User\Desktop\username.csv')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\User\\Desktop\\username.csv'
I've already searched for similar questions, mostly of them sugest the problem is the (r'C:\completelocalfile), but I already tried, as you can see on my code, however it's not working for me. Any sugestions?
Does this help? Basically, Google Colab cannot access your local machine files.
As a workaround, I would suggest to upload file on you drive, mount your drive in Colab, and then load the file from there.
The snippet to mount drive is the following:
from google.colab import drive
drive.mount('/content/drive', force_remount=True)
After that, you can upload the file manually and finally you load the file with the following command:
filename = r'/content/drive/MyDrive/pathtoyourfile'
import csv
open(filename)

FileNotFoundError: [Errno 2] No such file or directory: 'data/train.tsv'

I'm trying to run a .ipynb file from a gitlab repo on jupyternotebook. I got the error FileNotFoundError: [Errno 2] No such file or directory: 'data/train.tsv' so I figured that python is looking for the .tsv file in the wrong directory so in order to solve this I have to find where the .tsv file is first, but I can't find the file anywhere in the repo. Not sure if I'm understanding this error correctly.
Here is the full traceback

Error when reading pickle file - permission error

I'm trying to read a pickle file.
df= pd.read_pickle(r'C:\\Users\\Downloads\\pickle_file')
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Downloads\\pickle_file'
I have no other instances of python running. It's my first time importing the pickle file. What causes this issue?

I have downloaded an have Unzipped the glove file in my google colab , but still I'm unable to access it

I'm getting this error when I'm trying to access to run this code:
word_embedding_matrix = np.load(open("word_embedding_matrix.npy", 'rb'))
FileNotFoundError
Traceback (most recent call last)
in ()
----> 1 word_embedding_matrix = np.load(open("word_embedding_matrix.npy", 'rb'))
FileNotFoundError: [Errno 2] No such file or directory: 'word_embedding_matrix.npy'
The most common reason for that is you didn't mount your google drive to your notebook. You can do that easily by running the following code in the first cell of your notebook:
import os
from google.colab import drive
drive.mount('/content/gdrive')
ROOT = "/content/gdrive/My Drive/"
os.chdir(ROOT)
This code enables your notebook to access your google drive and you can access your GoogleDrive the same as you do with your local disk. So, when you run
os.listdir('.'), you should find word_embedding_matrix.npy among the returned items.
Source: official documentation

Django write to csv in views not working

In my views I have:
import csv
outputfile = open("test.csv", 'w')
I am getting a [Errno 13] Permission Denied
So I tried just opening the file:
outputfile = open("test.csv")
I am getting a [Errno 2] No such file or directory: 'test.csv' when I try to open it.
When I run the same line of code using python manage.py shell, the file opens without an error. test.csv is in the same folder as my views.
Why am I getting these errors and how do I go about fixing them?

Categories