N
N
NitroDesktop2021-04-21 22:05:08
Python
NitroDesktop, 2021-04-21 22:05:08

How to ignore archive with password?

I tried to read the data in the archive and the password turned out to be there, how to ignore it so that it would not give an error?


d:\Admin\Documents\1\Files\BELOFF dp 2O2O\dpack\DriveCeo\PESRS\DCWin10x64\PESRS.7z
Traceback (most recent call last):
File "d:\Documents\test\scanner\sss.py", line 102, in
find_7z(sfile,text_file)
File "d:\Documents\test\scanner\sss.py", line 20, in find_7z
archive = py7zr.SevenZipFile(dir_file, mode='r')
File "C:\ Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\py7zr\py7zr.py", line 361, in __init__
raise e
File "C:\Users\Admin\AppData\Local\Programs\Python \Python39\lib\site-packages\py7zr\py7zr.py", line 347, in __init__
self._real_get_contents(password)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\py7zr\py7zr.py", line 388, in _real_get_contents
header = Header.retrieve(self.fp, buffer, self .afterheader, password)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\py7zr\archiveinfo.py", line 905, in retrieve
obj._read(fp, buffer, start_pos, password)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\py7zr\archiveinfo.py", line 938, in _read
decompressor = folder.get_decompressor(compressed_size)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\py7zr\archiveinfo.py", line 424, in get_decompressor
self.decompressor = SevenZipDecompressor(self.coders, packsize, self.unpacksizes, self.crc, self.password)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\py7zr \compressor.py", line 501, in __init__
raise PasswordRequired("Password is required for extracting given archive.")
py7zr.exceptions.PasswordRequired: Password is required for extracting given archive.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexa2007, 2021-04-21
@NitroDesktop

try:
    #лезу в архив
except Exception as e:
    print(e)

S
soremix, 2021-04-21
@SoreMix

archive.needs_password()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question