2
$\begingroup$

I'm currently working on a script for blender and I used the Modal Timer Template. The problem is that one line is constantly giving me errors.

Here the source code:

def execute(self, context):
    wm = context.window_manager
    self._timer = wm.event_timer_add(0.1, context.window)
    wm.modal_handler_add(self)
    return {'RUNNING_MODAL'}

And I get the output message:

Traceback (most recent call last):
    File "/home/tobias/Datenablage/Programmieren/python/Artnet_Visualizer/Blender_implementation.blend/sniffer_timed.py", line 62, in <module>
    File "/home/tobias/Temp/blender-2.80-f36efe0e2ad-linux-glibc224-x86_64/2.80/scripts/modules/bpy/ops.py", line 200, in __call__
        ret = op_call(self.idname_py(), None, kw)
RuntimeError: Error: Traceback (most recent call last):
    File "/home/tobias/Datenablage/Programmieren/python/Artnet_Visualizer/Blender_implementation.blend/sniffer_timed.py", line 41, in execute
TypeError: WindowManager.event_timer_add(): required parameter "window" to be a keyword argument!
location: /home/tobias/Temp/blender-2.80-f36efe0e2ad-linux-glibc224-x86_64/2.80/scripts/modules/bpy/ops.py:200

I'm kinda new to scripting in Blender so I have no idea what I should do.

Thanks for your help

$\endgroup$
1
  • $\begingroup$ There are many changes in 2.80 and it appears this could be one. Given the error message try wm.event_timer_add(0.1, window=context.window) ie make it a keyword argument. $\endgroup$
    – batFINGER
    Oct 2, 2018 at 17:13

1 Answer 1

3
$\begingroup$

The comment above by batFINGER worked:

There are many changes in 2.80 and it appears this could be one. Given the error message try wm.event_timer_add(0.1, window=context.window) ie make it a keyword argument.

$\endgroup$
1
  • $\begingroup$ Worth also mentioning. A keyword argument has a default, (Haven't checked but) Most probable default in this case is context.window. If this is the case can use wm.event_timer_add(0.1) $\endgroup$
    – batFINGER
    Oct 3, 2018 at 11:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .