C:\Users\Admin>pip uninstall pyqt5-tools
WARNING: Skipping pyqt5-tools as it is not installed.
C:\Users\Admin>pip install --upgrade --user pyqtwebengine==5.12
ERROR: Could not find a version that satisfies the requirement pyqtwebengine==5.12 (from versions: 5.14.0, 5.15.0, 5.15.1, 5.15.2, 5.15.3, 5.15.4, 5.15.5)
ERROR: No matching distribution found for pyqtwebengine==5.12
C:\Users\Admin>pip install --upgrade --user pyqt5==5.12
ERROR: Could not find a version that satisfies the requirement pyqt5==5.12 (from versions: 5.14.0, 5.14.1, 5.14.2, 5.15.0, 5.15.1, 5.15.2, 5.15.3, 5.15.4, 5.15.5, 5.15.6)
ERROR: No matching distribution found for pyqt5==5.12
Traceback (most recent call last):
File "downloadimg.py", line 32, in
OSError: [Errno 22] Invalid argument: 'downloaded_images/7396?s=64&v=4'
[7868] Failed to execute script downloadimg
Traceback (most recent call last):
File "downloadimg.py", line 32, in
OSError: [Errno 22] Invalid argument: 'downloaded_images/7396?s=64&v=4'
[7868] Failed to execute script downloadimg
'NoneType' object has no attribute 'mime_type'
@bot.message_handler(content_types=['document', 'audio'])
def handle_docs_audio(message):
# bot.send_message(My_ID,message)
# bot.send_audio(chat_id=My_ID, audio=file_info.file_path)
# bot.reply_to(My_ID,bot.get_file(message.audio.file_id))
# bot.send_message(My_ID, reply_audio)
# bot.forward_message(My_ID, message.chat.id, message.audio)
# bot.forward_message(My_ID, message.chat.id, message.text)
# bot.send_audio(My_ID,message.audio)
try:
# audio_id = message.audio.file_id
# file_info = bot.get_file(audio_id)
# chat_id = message.chat.id
if message.audio.mime_type:
if message.audio.mime_type=="audio/mpeg":
print("Файл формата .mp3")
bot.reply_to(message, "Прости но формат mp3 нельзя заливать!")
if message.audio.mime_type=="audio/x-wav" or message.audio.mime_type=="audio/ogg" or message.audio.mime_type=="audio/flac" or message.audio.mime_type=="audio/annodex":
print("best")
print(message.audio.duration)
bot.forward_message(My_ID, message.chat.id, message.message_id)
if message.audio.performer:
if message.audio.title:
bot.reply_to(message, "Отправлен!")
# bot.send_message(message.chat.id,"Файл с подпесью "+message.audio.performer+" - "+message.audio.title)
else:
bot.reply_to(message, "Не определен файл!")
# downloaded_file = bot.download_file(file_info.file_path)
# src = 'C:\\' + message.audio.file_name;
# with open(src, 'wb') as new_file:
# new_file.write(downloaded_file)
# bot.reply_to(message, "Пожалуй, я сохраню это")
except Exception as e:
bot.reply_to(message, e)
# bot.reply_to(My_ID,bot.get_file(message.document.file_id))
bot.forward_message(My_ID, message.chat.id, message.message_id)
2021-04-23 15:19:44,850 (__init__.py:526 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: file is too big"
bot.forward_message(My_ID, message.chat.id, message.audio)
bot.forward_message(My_ID, message.chat.id, message.text)
bot.send_audio(My_ID,message.audio)
sInfo.encode().decode('cp1251', 'ignore')
import os
import zipfile
import rarfile
import py7zr
def files(path):
for file in os.listdir(path):
if os.path.isfile(os.path.join(path, file)):
yield file
def is_files(szInfo,search):
szCount=0
for n,line in enumerate(szInfo.split()):
if search in line:
szCount+=1
return szCount
def check_rar(filecheck):
try:
archive=rarfile.RarFile(filecheck, 'r')
archive.close()
return True
except Exception as e:
print(e)
def find_rar(dir_file,search):
print(dir_file)
archive = rarfile.RarFile(dir_file, 'r')
info_arch=str(archive.namelist())
info_arch=info_arch.replace(",", "")
info_arch=info_arch.replace("'", "")
info_arch=info_arch.replace("]", "")
info_arch=info_arch.replace("[", "")
count = 0
f = open("scanarch.txt", "a")
if is_files(info_arch,search):
f.write("\n================================================================================================================\n")
f.write("Archive: %s\n" % dir_file)
for n,line in enumerate(info_arch.split()):
if search in line:
sInfo="File: "+line
count+=1
f.write(sInfo+'\n')
if count:
f.write(u'\nFound Files: '+str(count))
f.write("\n================================================================================================================")
f.close()
archive.close()
def check_7z(filecheck):
try:
archive=py7zr.SevenZipFile(filecheck,"r")
archive.close()
return True
except Exception as e:
print(e)
def find_7z(dir_file,search):
print(dir_file)
if py7zr.is_7zfile(dir_file):
archive = py7zr.SevenZipFile(dir_file, mode='r')
info_arch=str(archive.getnames())
info_arch=info_arch.replace(",", "")
info_arch=info_arch.replace("'", "")
info_arch=info_arch.replace("]", "")
info_arch=info_arch.replace("[", "")
count = 0
f = open("scanarch.txt", "a")
if is_files(info_arch,search):
f.write("\n================================================================================================================\n")
f.write("Archive: %s\n" % dir_file)
for n,line in enumerate(info_arch.split()):
if search in line:
sInfo="File: "+line
count+=1
f.write(sInfo+'\n')
if count:
f.write(u'\nFound Files: '+str(count))
f.write("\n================================================================================================================")
f.close()
archive.close()
def check_zip(filecheck):
try:
archive=zipfile.ZipFile(filecheck, 'r')
archive.close()
return True
except Exception as e:
print(e)
def find_zip(dir_file,search):
print(dir_file)
zipFile = zipfile.ZipFile(dir_file, 'r')
info_arch=str(zipFile.namelist())
info_arch=info_arch.replace(",", "")
info_arch=info_arch.replace("'", "")
info_arch=info_arch.replace("]", "")
info_arch=info_arch.replace("[", "")
count = 0
f = open("scanarch.txt", "a")
if is_files(info_arch,search):
f.write("\n================================================================================================================\n")
f.write("Archive: %s\n" % dir_file)
for n,line in enumerate(info_arch.split()):
if search in line:
sInfo="File: "+line
count+=1
f.write(sInfo+'\n')
if count:
f.write(u'\nFound Files: '+str(count))
f.write("\n================================================================================================================")
f.close
zipFile.close()
filename=""
sfile=""
print("Введите путь где искать архивы файлы")
dir_files=input()
print("Что искать в архивах!")
text_file=input()
print("...")
for top, dirs, files in os.walk(dir_files):
for nm in files:
filename=os.path.join(top, nm)
if filename!=sfile:
sfile=filename
ext = os.path.splitext(filename)[1]
if ext=='.zip':
if zipfile.is_zipfile(sfile) and check_zip(sfile):
find_zip(sfile,text_file)
# if ext=='.7z' or ext=='.7zip':
# if check_7z(sfile):
# find_7z(sfile,text_file)
# if ext=='.rar':
# if rarfile.is_rarfile(sfile) and check_rar(sfile):
# find_rar(sfile,text_file)
.txt
...
d:\fsecure_freedome_vpn_2.40.6717.zip
Traceback (most recent call last):
File "d:\Documents\test\scanner\sss.py", line 133, in
find_zip(sfile,text_file)
File "d:\Documents\test\scanner\sss.py", line 110, in find_zip
f.write(sInfo+'\n')
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\encodings\cp1251.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xc4' in position 6: character maps to
try:
archive=py7zr.SevenZipFile(filecheck,"r")
archive.close()
except Exception as e:
print(e)