I'm trying to use Gephi Toolkit in Jython, but having problems with it. The code is below:
import sys
sys.path.append('gephi-toolkit.jar')
from org.openide.util import Lookup
import org.gephi.project.api.ProjectController as ProjectController
pc = Lookup.getDefault().lookup(ProjectController)
workspace = pc.newProject()
print "done."
It never reaches the last line. Instead gives the following error:
Traceback (most recent call last):
File "standalone.py", line 9, in <module>
workspace = pc.newProject()
AttributeError: 'NoneType' object has no attribute 'newProject'
Apparently, "Lookup.getDefault().lookup(ProjectController)" is returning None. Can anyone tell me why? I found that the following workaround works (which bypasses Lookup):
...
import org.gephi.project.impl.ProjectControllerImpl as ProjectControllerImpl
pc = ProjectControllerImpl()
workspace = pc.newProject()
I'd like to know more about this issue. Thanks.