0
後続の実行呼び出しで使用できるrexpro接続でグローバル変数を作成しようとしていますが、グローバル変数が機能していません。以下は簡単なコードスニペットです。python rexpro接続でグローバル変数にアクセスできない
from rexpro import RexProConnection
conn = RexProConnection('localhost', 8184, 'graph')
#number will become a global variable for this session
conn.execute("number = 5")
conn.execute("number")
は、私は私が私の最後の行に再び番号変数を呼び出すときに、次のエラーを取得
Traceback (most recent call last):
File "test.py", line 5, in <module>
conn.execute("number")
File "/opt/savvi-deps/python27/lib/python2.7/site-packages/rexpro/connectors/base.py", line 426, in execute
response.raise_exception()
File "/opt/savvi-deps/python27/lib/python2.7/site-packages/rexpro/messages.py", line 198, in raise_exception
raise exceptions.RexProScriptException(self.message)
rexpro.exceptions.RexProScriptException: An error occurred while processing the script for language [groovy]. All transactions across all graphs in the session have been concluded with failure: java.util.concurrent.ExecutionException: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: number for class: Script17
私は何を持っていると思ったことは、私は以下のように私のコードでは、後者を使用することができます管理オブジェクトです。このページでは
from rexpro import RexProConnection
conn = RexProConnection('localhost', 8184, 'graph')
#number will become a global variable for this session
conn.execute("mgmt=g.getManagementSystem()")
conn.execute("mgmt.makePropertyKey('name').dataType(String.class).make()")
続く例は: