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.
开发者_StackOverflow社区Any help would be great.
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.
精彩评论