How can I properly set up context in plugins?
I am importing Digital Terrain Models using a python plugin.
def register():
bpy.utils.register_class(DTM)
bpy.types.INFO_MT_mesh_add.append(add_to_menu)
I get the following error.
C_dict, C_exec, C_undo = BPyOpsSubModOp._parse_args(args) File "C:\Program Files\Blender Foundation\Blender\2.67\scripts\modules\bpy\ops.py", line 142, in _parse_args raise ValueError("1-3 args execution context is supported") ValueError: 1-3 args execution context is supported
How can I fix this?
dtm = bpy.ops.import_img.load(self,context,filepath=self.filepath,scale=self.scale,bin_mode=self.bin_mode, cropVars=False,)
except ValueError:
print("location:
selfandcontextwhen calling an operator. Those first two argument positions are reserved for execution context. – Adhi Jun 11 '13 at 03:18it seems to be an incorrect file location.
using:
filepath = bpy.path.ensure_ext(filepath, filename_ext)
bpy.ops throws:
location:
bpy.ops.mesh.decimate(ratio=0.18)if I trybpy.ops.mesh.decimate(0.18)I get that 1-3 params error too. – Aquarius Power Dec 03 '21 at 03:28