Skip to content

Instantly share code, notes, and snippets.

@p2or
Last active May 22, 2023 14:08
Show Gist options
  • Save p2or/154a8998a16acf23444397ebdba997ee to your computer and use it in GitHub Desktop.
Save p2or/154a8998a16acf23444397ebdba997ee to your computer and use it in GitHub Desktop.
Supress Operator output II #Blender #BSE
# for http://blender.stackexchange.com/questions/56087/check-if-an-operation-can-be-applied-without-runtime-errors
import bpy
if bpy.ops.mesh.fill_grid.poll():
print("correct context")
try:
bpy.ops.mesh.fill_grid()
except RuntimeError as exception:
error = "\n".join(exception.args)
print("error:", error)
else:
print ("incorrect context")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment