Answer the question
In order to leave comments, you need to log in
Why does not see the token variable in the script?
the script gives an error name "vk_api" is not defined
import vk_api as message
import requests
import os
import time
import api
import vk
def main():
all_tokens = list()
try:
file = open("tokens.txt", 'r')
for line in file.readlines():
all_tokens.extend(line.rstrip().split(' '))
users = ['', '', '']
try:
chats = input('Кол-во создаваемых бесед: ')
spot = 0
while int(spot) < int(chats):
vk = vk_api.messages.createChat(user_ids=users, title="text") #название беседы
spot += 1
time.sleep(80)
except Exception as er:
print(er)
except:
a = os.listdir()
print('Убедитесь, что в текущей директории есть файл с токенами, возможно он просто неверно назван.\nВсе файлы в текущей директории:\n')
b = input(a)
main()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question