- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的环境是:
java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
python3 --version
Python 3.7.4
这应该是唯一相关的环境部分。不幸的是,我在 MacOS 上并使用 macports 可能会有所不同,这不应该是一个问题。
我刚刚在 Ubuntu 18.04 LTS 上进行了测试,请参阅 http://wiki.bitplan.com/index.php/Gremlin_python#Installlation_automation并且行为是相同的。
所以我想尝试一下 gremlin-python。我发现https://pypi.org/project/gremlinpython/并高兴地添加了
gremlinpython
我的要求.txt
sudo -H pip install -r requirements.txt
运行成功 - 太棒了。让我们找一些 python 代码来玩一下。
有。
哦 - 我需要一台服务器...
下载吧
解压缩它并为其创建一个启动文件,如上面的示例所示:
gspath=$HOME/Downloads/apache-tinkerpop-gremlin-server-3.4.3
#$gspath/bin/gremlin-server.sh install org.apache.tinkerpop gremlin-python 3.4.3
$gspath/bin/gremlin-server.sh $gspath/conf/gremlin-server-modern-py.yaml
它不起作用 - 从 Tornado 中获得 599 超时。
看:
Why can't I connect to Gremlin-Server?
尝试提示,例如使用 0.0.0.0 作为主机
检查启动情况。
糟糕 - 有错误:
Could not initialize gremlin-jython GremlinScriptEngine as init script could not be evaluated
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: gremlin-jython is not an available GremlinScriptEngine
at java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:375)
at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1934)
at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.lambda$new$4(ServerGremlinExecutor.java:141)
at java.util.LinkedHashMap$LinkedKeySet.forEach(LinkedHashMap.java:559)
at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:136)
at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:122)
at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:86)
at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:345)
Caused by: java.lang.IllegalArgumentException: gremlin-jython is not an available GremlinScriptEngine
at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.registerLookUpInfo(CachedGremlinScriptEngineManager.java:95)
at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.getEngineByName(CachedGremlinScriptEngineManager.java:58)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[WARN] ServerGremlinExecutor - Could not initialize gremlin-python GremlinScriptEngine as init script could not be evaluated
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: gremlin-python is not an available GremlinScriptEngine
at java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:375)
at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1934)
at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.lambda$new$4(ServerGremlinExecutor.java:141)
at java.util.LinkedHashMap$LinkedKeySet.forEach(LinkedHashMap.java:559)
at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:136)
at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:122)
at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:86)
at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:345)
Caused by: java.lang.IllegalArgumentException: gremlin-python is not an available GremlinScriptEngine
at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.registerLookUpInfo(CachedGremlinScriptEngineManager.java:95)
at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.getEngineByName(CachedGremlinScriptEngineManager.java:58)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
gremlin-python is not an available GremlinScriptEngine
提到应该安装服务器插件。我原以为
$gspath/bin/gremlin-server.sh install org.apache.tinkerpop gremlin-python 3.4.3
会这样做,当我再次运行它时,我得到:
Installing dependency org.apache.tinkerpop gremlin-python 3.4.3
Could not install the dependency: a module with the name gremlin-python is already installed
如何从这里开始工作?
我将 python 测试代码缩减为:
# https://pypi.org/project/gremlinpython/
# start GremlinServer
# bin/gremlin-server.sh -i org.apache.tinkerpop gremlin-python 3.2.2-SNAPSHOT
# bin/gremlin-server.sh conf/gremlin-server-modern-py.yaml
# in practice, you really only need the 3 imports below
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
# this allows us to do g.V().repeat(out()) instead of g.V().repeat(__.out())-type traversals
#statics.load_statics(globals())
# create a remote connection using RemoteStrategy
graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182','g'))
print (g.V().count().value())
最佳答案
我怀疑您已经有解决方法了 - 但我认为 599 是由于您无法在本地计算机设置之外的任何其他设备上访问 ws 端口。我在隔离安装时遇到了类似的问题。
如果您将 gremlin yaml 中的主机属性设置为 0.0.0.0 - 它将监听所有接口(interface)。在本地主机上测试所有内容给了我一种错误的安全感 - 当我监听所有网络接口(interface)时起作用 - 这反过来又允许我拥有与 gremlin 服务器不同的客户端。
关于python - 如何让 Gremlin-Python 与 gremlin-server 3.4.3 一起工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57936915/
我是一名优秀的程序员,十分优秀!