1

I did the Nodebox tutorial on the graph library:

http://nodebox.net/code/index.php/Graph#loading_the_library

I installed the library in Application Support I pasted the following code:

graph = ximport("graph")
create(iterations=1000, distance=1.0, layout="spring", depth=True)

And I got this error message:

Traceback (most recent call last):
  File "nodebox/gui/mac/__init__.pyo", line 358, in _execScript
  File "mypath", line 2, in <module>
NameError: name 'create' is not defined

And before that I got this:

NameError: name 'ximport' is not defined

If I close the file and reopen and just say graph = ximport("graph")

Nothing happens (it seems to work).

I think it would be a very cool library to work with.

Any help would be great.

jscs
  • 63,694
  • 13
  • 151
  • 195
digit
  • 1,513
  • 5
  • 29
  • 49

1 Answers1

0

The problem is with your Path, as the tutorial link that you pointed to said:

Put the graph library folder in the same folder as your script so NodeBox can find the library. You can also put it in ~/Library/Application Support/NodeBox/.

Otherwise install content from the graph.zip

and do

import graph
graph.create

Sorry, I don't have MAC to try these. But the error messages are saying that Python is not able to find your modules properly. For python to find it, they should be in the current directory or in the PYTHONPATH.

Senthil Kumaran
  • 54,681
  • 14
  • 94
  • 131
  • So if I look up the package contents of Nodebox, it says in Python Framework-Versions only 2.5. I am running on 2.6 and I had problems with this. So do you think Nodebox is using 2.5 and therefore cant find what? I dont know what could possible miss. Other modules worked fine. Maybe the graph module is using something that it cant find. What would that be? Thanks!! – digit Feb 10 '11 at 09:25
  • Download the graph.zip and extract it. You will get a folder by by name graph. You will have to this graph folder to a particular directory. Move it to the place which is suggested in the tutorial. OR. Open your python interpreter and type `import sys;sys.path` . Move the graph folder into any of these directories. After you restart the interpeter, you shoudl do `import graph` and it should not throw an error. If this happens, you are good to go! :) – Senthil Kumaran Feb 10 '11 at 09:37
  • Thanks!. But now I get an empty white page. – digit Feb 10 '11 at 10:21
  • Follow some examples! :) But you got it working now. Rest should be easy. :) – Senthil Kumaran Feb 10 '11 at 10:25