Module has no attribute PostDelayedTask

30 views
Skip to first unread message

valveu...@gmail.com

unread,
Jul 4, 2017, 10:42:36 PM7/4/17
to CEF Python
Hello!

I tried to use cef's PostDelayedTask method, but an error occured:

Traceback (most recent call last):
File "C:\Users\Somewho\Desktop\ceftest.py", line 8, in <module>
cef.PostDelayedTask(cef.TID_UI, 5000, cef.QuitMessageLoop)
AttributeError: module 'cefpython3.cefpython_py36' has no attribute 'PostDelayedTask'

My code:

from cefpython3 import cefpython as cef
import sys

sys.excepthook = cef.ExceptHook

cef.Initialize()
cef.CreateBrowserSync(url = "https://music.yandex.ru")
cef.PostDelayedTask(cef.TID_UI, 5000, cef.QuitMessageLoop) # <-- crash
cef.MessageLoop()
cef.Shutdown()

Please help me. Thanks!

Czarek Tomczak

unread,
Jul 5, 2017, 12:23:10 AM7/5/17
to CEF Python
Hi valveunion76,

Function PostDelayedTask was added in commit 7145ffa and will be available in the next release.

If you want it now then apply the patch in the cefpython57 branch and build it from sources. See the docs/Build-instructions.md document for instructions.

Cheers.

Czarek Tomczak

unread,
Jul 5, 2017, 12:28:17 AM7/5/17
to CEF Python
Alternatively you could use the threading module:

import threading
args = [cef.TID_UI, cef.QuitMessageLoop]
threading.Timer(
5, cef.PostTask, args).start()

valveu...@gmail.com

unread,
Jul 5, 2017, 11:35:15 AM7/5/17
to CEF Python
Thank you very much, Czarek!
Reply all
Reply to author
Forward
0 new messages