Pydev Nodebox: “AttributeError: 'NoneType' object has no attribute 'WIDTH'”

≡放荡痞女 提交于 2019-12-24 09:16:47

问题


I am trying to create a graph of the connections between the users in my database using nodebox(ubuntu 12.04, python 2.7, django 1.3), but when I enter the following instructions, I get the error message underneath it:

"""    
g.draw(weighted=False, directed=False, highlight=[], traffic=None)  
Traceback (most recent call last):  
  File "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py", line 2721, in run_code  
    exec code_obj in self.user_global_ns, self.user_ns  
  File "<ipython-input-1-0a219395b690>", line 1, in <module>  
    g.draw(weighted=False, directed=False, highlight=[], traffic=None)  
  File "/home/raymond/Documents/exchange/cet/cet/graph/__init__.py", line 453, in draw
    self.update()  
  File "/path/to/myproject//graph/__init__.py", line 416, in update  
    self.x = _ctx.WIDTH - max.x*self.d - min_.x*self.d  
AttributeError: 'NoneType' object has no attribute 'WIDTH'  

"""

How can I get nodebox to draw my graph? should I add a try/catch or if statement to graph/init.py in order to prevent object of type none from being written to? I know displaying more code would help solve the problem faster; I am running into formatting problem, but I will add code to the question as soon as I can.


回答1:


Nodebox has a graph web page which is concise, informative and seemed what I need. As the file to download is on the same page it seemed ideal, BUT it fails to mention it is Nodebox 1 which is for Mac ...only!

Then a further rummage finds NodeBox OpenGL which has a new methodology and is cross platform, BUT it only lists compatibility with python 2.5-2.6 (so with 2.7 should be worth a try?) BUT installing the graphics util Pyglet failed the first time ....so more investigation required.

Sadly Nodebox 3 seems all different and haven't yet seen a comparable graph command

Looking back on the outcome

After achieving an install, I prototyped network viewer with a mouse selectable attribute viewer, low frame rate and a constant data set. A flavour of the interactiveness is demonstrated in this site

http://www.visualthesaurus.com/app/view?word=link (try a click and drag on the central word)

But problems I needed to solve were how to

  • show a live data set consistently ie dealing with orphans, transitions as branches you may be viewing may disappear from the data
  • partitioning the viewing of large amounts of data ie view 2 to 20 nodes from several hundred items
  • displaying data without overlapping/obscuring or going off the display area
  • displaying differences when not on the current level
  • portability
  • ...

In my case a periodically updated, structured html table with colours and zoom levels was the best solution



来源:https://stackoverflow.com/questions/14996530/pydev-nodebox-attributeerror-nonetype-object-has-no-attribute-width

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!