-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unzip/extract options can't handle .7z files for some reason #98
Comments
This would require the |
Would just throwing an error message informing the user what's missing if it's not available be an acceptable workaround? |
I have the same problem also with .zip files: $ brew install pipx
$ pipx install lastversion
$ lastversion --assets download SamusAranX/MinimalMIDIPlayer
Downloaded MinimalMIDIPlayer-v1.13.zip: : 7368.0KB [00:00, 10763.89KB/s]
$ unzip MinimalMIDIPlayer-v1.13.zip
Archive: MinimalMIDIPlayer-v1.13.zip
creating: MinimalMIDIPlayer.app/
...
$ rm -rf MinimalMIDIPlayer*
$ lastversion --assets unzip SamusAranX/MinimalMIDIPlayer
MinimalMIDIPlayer-v1.13.zip: 7368.0KB [00:00, 10887.83KB/s]
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tarfile.py", line 1876, in gzopen
t = cls.taropen(name, mode, fileobj, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tarfile.py", line 1853, in taropen
return cls(name, mode, fileobj, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tarfile.py", line 1711, in __init__
self.firstmember = self.next()
^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tarfile.py", line 2635, in next
raise e
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tarfile.py", line 2608, in next
tarinfo = self.tarinfo.fromtarfile(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tarfile.py", line 1293, in fromtarfile
buf = tarfile.fileobj.read(BLOCKSIZE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/gzip.py", line 324, in read
return self._buffer.read(size)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/_compression.py", line 68, in readinto
data = self.read(len(byte_view))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/gzip.py", line 527, in read
if not self._read_gzip_header():
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/gzip.py", line 496, in _read_gzip_header
last_mtime = _read_gzip_header(self._fp)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/gzip.py", line 456, in _read_gzip_header
raise BadGzipFile('Not a gzipped file (%r)' % magic)
gzip.BadGzipFile: Not a gzipped file (b'PK')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/voglerr/.local/bin/lastversion", line 10, in <module>
sys.exit(main())
^^^^^^
File "/Users/voglerr/Library/Application Support/pipx/venvs/lastversion/lib/python3.12/site-packages/lastversion/lastversion.py", line 890, in main
extract_file(url)
File "/Users/voglerr/Library/Application Support/pipx/venvs/lastversion/lib/python3.12/site-packages/lastversion/utils.py", line 415, in extract_file
extract_tar(buffer, mode)
File "/Users/voglerr/Library/Application Support/pipx/venvs/lastversion/lib/python3.12/site-packages/lastversion/utils.py", line 358, in extract_tar
with tarfile.open(fileobj=buffer, mode=mode) as tar_file:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tarfile.py", line 1821, in open
return func(name, filemode, fileobj, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tarfile.py", line 1880, in gzopen
raise ReadError("not a gzip file") from e
tarfile.ReadError: not a gzip file |
Also, what's the difference between extract and unzip? |
Reported issues: - add Homebrew package: SamusAranX/MinimalMIDIPlayer#14 - `lastversion unzip` did not work: dvershinin/lastversion#98 (comment)
Still does not work for me with #141: $ pipx uninstall lastversion
uninstalled lastversion! ✨ 🌟 ✨
$ pipx install git+https://github.com/dvershinin/lastversion
installed package lastversion 3.4.6, installed using Python 3.12.1
These apps are now globally available
- lastversion
done! ✨ 🌟 ✨
$ lastversion --assets unzip SamusAranX/MinimalMIDIPlayer
MinimalMIDIPlayer-v1.13.zip: 7368.0KB [00:00, 44333.42KB/s]
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/lastversion/utils.py", line 378, in extract_tar_and_zip
with tarfile.open(fileobj=buffer, mode="r") as file:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 1811, in open
raise ReadError(f"file could not be opened successfully:\n{error_msgs_summary}")
tarfile.ReadError: file could not be opened successfully:
- method gz: ReadError('not a gzip file')
- method bz2: ReadError('not a bzip2 file')
- method xz: ReadError('not an lzma file')
- method tar: ReadError('bad checksum')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/bin/lastversion", line 8, in <module>
sys.exit(main())
^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/lastversion/lastversion.py", line 889, in main
extract_file(url)
File "/opt/homebrew/lib/python3.11/site-packages/lastversion/utils.py", line 437, in extract_file
extract_tar_and_zip(buffer, to_dir=to_dir)
File "/opt/homebrew/lib/python3.11/site-packages/lastversion/utils.py", line 384, in extract_tar_and_zip
extract_archive(file)
File "/opt/homebrew/lib/python3.11/site-packages/lastversion/utils.py", line 373, in extract_archive
archive_file.extract(item, to_dir)
File "/opt/homebrew/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/zipfile.py", line 1664, in extract
return self._extract_member(member, path, pwd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.7_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/zipfile.py", line 1735, in _extract_member
open(targetpath, "wb") as target:
^^^^^^^^^^^^^^^^^^^^^^
NotADirectoryError: [Errno 20] Not a directory: 'Contents/CodeResources' |
@vogler |
Thanks, works now 👍 $ lastversion --assets unzip SamusAranX/MinimalMIDIPlayer
MinimalMIDIPlayer-v1.13.zip: 7368.0KB [00:00, 30144.44KB/s]
$ ll | grep Mini
drwxr-xr-x 3 voglerr staff 96 Jan 26 20:46 MinimalMIDIPlayer.app |
Are you making a release for this? If not, I'll just keep |
@vogler Fixed in lastversion v3.5.0 |
The text was updated successfully, but these errors were encountered: