Fixed redefining built-in
This commit is contained in:
@@ -15,8 +15,8 @@ def captcha_handler(captcha):
|
|||||||
# getting pazans
|
# getting pazans
|
||||||
pazanIds = None
|
pazanIds = None
|
||||||
pazansFileName = sys.argv[1]
|
pazansFileName = sys.argv[1]
|
||||||
with open(pazansFileName, "r") as file:
|
with open(pazansFileName, "r") as pazans_file:
|
||||||
jsonData = json.loads(file.read())
|
jsonData = json.loads(pazans_file.read())
|
||||||
pazanIds = [item[0] for item in sorted(jsonData.items(), key=lambda item: len(item[1]), reverse=True)]
|
pazanIds = [item[0] for item in sorted(jsonData.items(), key=lambda item: len(item[1]), reverse=True)]
|
||||||
|
|
||||||
vk = vk_api.VkApi(token=sys.argv[3], app_id=sys.argv[4], captcha_handler=captcha_handler)
|
vk = vk_api.VkApi(token=sys.argv[3], app_id=sys.argv[4], captcha_handler=captcha_handler)
|
||||||
@@ -38,8 +38,8 @@ for index, pazanId in enumerate(pazanIds, start=(int(sys.argv[5]) if len(sys.arg
|
|||||||
"url" : audio["url"],
|
"url" : audio["url"],
|
||||||
}
|
}
|
||||||
pazanSongs.append(pazanSong)
|
pazanSongs.append(pazanSong)
|
||||||
with open(sys.argv[2], "a", encoding="utf-8") as file:
|
with open(sys.argv[2], "a", encoding="utf-8") as f_out:
|
||||||
file.write(json.dumps({pazanId: pazanSongs}, ensure_ascii=False) + "\n")
|
f_out.write(json.dumps({pazanId: pazanSongs}, ensure_ascii=False) + "\n")
|
||||||
done = True
|
done = True
|
||||||
except vk_api.ApiError as e:
|
except vk_api.ApiError as e:
|
||||||
if e.code == 9:
|
if e.code == 9:
|
||||||
|
|||||||
Reference in New Issue
Block a user