Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# for http://blender.stackexchange.com/questions/56087/check-if-an-operation-can-be-applied-without-runtime-errors
import bpy
import io
from contextlib import redirect_stdout
if bpy.ops.mesh.fill_grid.poll():
print("correct context")
else:
print ("incorrect context")
stdout = io.StringIO()
with redirect_stdout(stdout):
try:
bpy.ops.mesh.fill_grid()
except:
pass
stdout.seek(0)
output = stdout.read()
print("Report was %r" % output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.