I am trying to unzip my zip file on google colab but it is not working for me below are the details
Command used
!unzip "drive/MyDrive/Dog Vision2/dog-breed-identification.zip" -d "drive/MyDrive/Dog Vision2"
Error Message
Archive: drive/MyDrive/Dog Vision2/dog-breed-identification.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of drive/MyDrive/Dog Vision2/dog-breed-identification.zip or
drive/MyDrive/Dog Vision2/dog-breed-identification.zip.zip, and cannot find drive/MyDrive/Dog Vision2/dog-breed-identification.zip.ZIP, period.
File Name Snippet
Note: I am able to unzip same file on my local machine.
My bad, I just saw my zip file was not fully uploaded.
For others, please re-check if the file is uploaded on drive or not, before running unzip command. PFB snippet where you can check it.
Note :
At Bottom of the left panel we can see if the file is uploaded
successfully or not.
Red Highlighted is the zip which was not uploaded successfully.
Green Highlighted is the zip which is in progress.
Related
I have started to use Colab. Now I want to from the notebook automatically upload a couple of smaller files from my Github repository.
My idea is that I should try to upload these files directly to the workspace of the Colab virtual machine and use of Google Drive not necessary. This strategy should also facilitate sharing the notebook with others.
My Colab notebook code is as follows:
%%bash
git clone https://github.com/my_repository/folder1
%load folder1/file1.py
run -i file1.py
%load folder1/file2.zip
The first two command works fine but the two last gives error messages.
The error message when I try run file1.py is:
ERROR: root:File 'file1.py' not found.
And the error message when I try to load file2.zip
File "<string>", line unknown
SyntaxError: invalid or missing encoding declaration for 'folder1/file2.zip'
(The file2.zip contains both some text file and an executable file for linux environment)
How to solve this?
Note1. If I check the directory after the second command with !ls I see I have folder1
and when I do !ls folder1 then I see the content of that folder1. So looks ok so far.
Note2. If I mount my Google Drive and upload the folder here then I can get it all to work. But I want to avoid using Google Drive since that complicates sharing of the notebook, in my eyes.
Note3. What I can see the zip-file contains a binary that is described as ELF 64-bit LSB shared object, x86-64, version 1 (SYSV)
I found a solution I think and the code should be:
%%bash
git clone https://github.com/my_repository/folder1
%cd folder1
run -i file1.py
I am trying to download a file from my Dropbox account, however, on Linux (Raspbian) when I execute the line:
dbx = dropbox.Dropbox(TOKEN)
dbx.files_download_to_file(LOCAL_PATH,r'/file.ppsx')
It is downloaded as a zip. I do not have this problem executing the code on Windows. I'd like to note the file is a .ppsx, a PowerPoint presentation file. I have no problem downloading it manually from Dropbox. My question is, how can I circumvent this problem and download it unzipped?
It seems that Dropbox sent the file not as a zip, but rather changed the name of the file to the directory of where it was installed. I circumvented this problem by using the os.rename module. This solved the problem and allowed me to open the file within the same script.
I tried to upload an xes file into Google Colab and for a new dataset, it just doesn't work.
Google Drive is mounted and the new file is stored exactly where the old one was and I just switched the path.
Here is the code I used:
!pip install pm4py
import pm4py
from pm4py.objects.log.importer.xes import importer as xes_importer
from google.colab import drive
drive.mount('/content/gdrive')
log = xes_importer.apply('/content/gdrive/MyDrive/BPI Challenge 2017.xes.gz')
For another file that is stored in the same folder, the code worked. I tried it with the .gz and the .xes file and it's the same - works for two other datasets I already had but not for multiple other ones I tried.
Now I get the following error message:
File "<string>", line unknown
SyntaxError: invalid or missing encoding declaration for '/tmp/tmp0rajagivgz'
I tried unpacking the file first before uploading it (from gz to xes) but it also doesn't work, just the file name is changing.
I assume, the problem is that Google Drive considers the file a zip file even though the file I uploaded originally isn't. On my desktop, both datasets (the old and the new one after unpacking) are recognized as xes.
I don't know why Drive doesn't upload the new dataset as the file that it is.
Do you have any recommendations?
Any explanation would be helpful.
Best,
Linda
Edit: added the code
I have a URL which is a download link http://vis-www.cs.umass.edu/lfw/lfw.tgz
It is a huge file with multiple folders tar into one tgz file.
I want to download the file in chunks and want to trigger some event when one folder gets downloaded.
I am using Python's requests library to download the file, I know how to download the file in the chunks but is there any way to download folder by folder and trigger some event when the file is downloaded?
I am okay if I have to use some Linux utility, I can execute the command using subprocess but is there a way to do it ?
I am looking for small bash or python script that will install a .dmg file.
We'll assume that the dmg contains one or more .app directories that have to be copied to /Applications, overriding any already existing directories.
Files or directories not matching the *.app pattern are to be ignored.
You can mount the disk image using
hdiutil attach -mountpoint <path-to-desired-mountpoint> <filename.dmg>
The disk image will be mounted at the selected path (the argument following -mountpoint). Then, search for an .app file and copy the file to /Applications.
Once you have finished installation unmount the disk image:
hdiutil detach <path-to-mountpoint>