{"id":528,"date":"2013-11-20T20:12:18","date_gmt":"2013-11-20T20:12:18","guid":{"rendered":"http:\/\/daniepstein.com\/daniepstein\/?p=528"},"modified":"2014-06-26T08:25:26","modified_gmt":"2014-06-26T08:25:26","slug":"context-woes","status":"publish","type":"post","link":"https:\/\/daniepstein.com\/daniepstein\/context-woes\/","title":{"rendered":"Context woes"},"content":{"rendered":"<p>This hardly warrants anything more than a few quick lines.<\/p>\n<p>This line was bombing out:<\/p>\n<pre>bpy.ops.object.modifier_apply(modifier = 'Bla')<\/pre>\n<p>Well, the &#8220;wrong context&#8221; error reared its ugly head. That&#8217;s because there was nothing selected in the scene, even though there was an active object.<\/p>\n<p>So, when calling the above operator, ensure that there is a selected, active object in the scene.<\/p>\n<p>Calling<\/p>\n<pre>bpy.data.scenes[0].objects.active = some_obj<\/pre>\n<p>can save lives.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This hardly warrants anything more than a few quick lines. This line was bombing out: bpy.ops.object.modifier_apply(modifier = &#8216;Bla&#8217;) Well, the &#8220;wrong context&#8221; error reared its ugly head. That&#8217;s because there was nothing selected in the scene, even though there was &hellip; <a href=\"https:\/\/daniepstein.com\/daniepstein\/context-woes\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":""},"categories":[3],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2UnW3-8w","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/posts\/528"}],"collection":[{"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/comments?post=528"}],"version-history":[{"count":1,"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/posts\/528\/revisions"}],"predecessor-version":[{"id":529,"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/posts\/528\/revisions\/529"}],"wp:attachment":[{"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/media?parent=528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/categories?post=528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daniepstein.com\/daniepstein\/wp-json\/wp\/v2\/tags?post=528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}