from Tkinter import *
import sqlite3
import vk_api
def _main():
vk_session = vk_api.VkApi(e1, e2)
try:
vk_session.authorization()
except vk_api.AuthorizationError as error_msg:
print(error_msg)
conn = sqlite3.connect('userlist.db')
c = conn.cursor()
for row in c.execute('SELECT * FROM userids ORDER BY userid'):
massage = "*" + row[0]
vk.wall.post(owner_id=-128517099, message=message + str(e3))
master = Tk()
Label(master, text="vk login").grid(row=0)
Label(master, text="vk password").grid(row=1)
Label(master, text="vk message").grid(row=2)
Label(master, text="posting").grid(row=3)
e1 = Entry(master)
e2 = Entry(master)
e3 = Entry(master)
e4 = Entry(master)
e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e3.grid(row=2, column=1)
e4.grid(row=3, column=1)
b = Button(master, text="OK", command=_main)
b.grid(row=4, column=1)
mainloop()
Exception in Tkinter callback
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1537, in __call__
return self.func(*args)
File "/Users/mkhitaryan/Documents/vkposter.py", line 8, in _main
vk_session.authorization()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vk_api/vk_api.py", line 122, in authorization
self.vk_login()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vk_api/vk_api.py", line 153, in vk_login
response = self.http.post('https://login.vk.com/', values)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 522, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 461, in request
prep = self.prepare_request(req)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 394, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.py", line 297, in prepare
self.prepare_body(data, files, json)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.py", line 458, in prepare_body
body = self._encode_params(data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.py", line 98, in _encode_params
return urlencode(result, doseq=True)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 1360, in urlencode
len(v)
AttributeError: Entry instance has no attribute '__len__'