I'm new to Blender, and I'm finding that it's a very powerful tool so far. At the moment, I'm trying to enable an add-on called Chart Graphics Generator. However, it produces this error whenever I try to enable it:

AttributeError: '_RestrictContext' object has no attribute 'scene'

(The attached blend file in the very last post on the thread linked)

I've updated the Add-on: Precise-Align, but the error still persists. I found out that's it's due to an intentional deprecation from Blender with certain restrictions on context.

The Traceback says the problem is on line 44, in the globals section.

pid2 = pi * 0.5
sce = bpy.context.scene
obj = bpy.context.object
boo = bpy.ops.object
bot = bpy.ops.transform
suma = 0

chartType = '' #not yet used
negativValueSeen = False
sizesCVSfile = None
colnrPKHG = '-1'
cvs_colums = 0

What I've tried:

I've tried just running the script in a text box, without trying to use it as an add-on.

This partially works. However, it only shows the data labels of the imported CSV file, without any line charts relating to the values of my own CSV file.

The line charts that appear on start up relate to the default CSV file the developer wrote the path to.

I've also tried following the vimeo tutorial video with instructions on how to use it, but the method script just seems to have deprecated methods:


Being relatively new, I don't know how to go about solving this error. I know there must be a new way to write it, but I'm not sure where to start. Can someone please assist me in resolving this error?

  • 1
    $\begingroup$ The error is because addons can no longer use global variables. While I had a look I gave up trying to fix it. I found it easier to use sverchok to create a bar chart from csv data. This example might help you get started, it's my first attempt with sverchok so probably not the best way to do it. $\endgroup$ – sambler Aug 7 '14 at 16:19
  • $\begingroup$ Thank you for trying to fix it, I really appreciate it. I'll take a look into working with sverchok, it has really great examples! $\endgroup$ – Justin Baxtron Aug 7 '14 at 17:12
  • $\begingroup$ Read here why you can't access context members during init: wiki.blender.org/index.php/Extensions:2.6/Py/… $\endgroup$ – CodeManX Aug 18 '14 at 17:59
  • $\begingroup$ I understand that I can't access context members. (I wanted to post that link, but as a new user could only post 2). I'm just not sure on how to fix it. $\endgroup$ – Justin Baxtron Aug 21 '14 at 19:25

Browse other questions tagged or ask your own question.