2016-09-10 4 views
0

Ich versuche, ein Beispiel von http://codespeak.net/execnet/example/hybridpython.html aber Python friert auf Linie zu laufen:Python jython von execnet läuft nicht

gw = execnet.makegateway("popen//python=jython") 

Beispiel:

import execnet 
gw = execnet.makegateway("popen//python=jython") 
channel = gw.remote_exec(""" 
    from java.util import Vector 
    v = Vector() 
    v.add('aaa') 
    v.add('bbb') 
    for val in v: 
     channel.send(val) 
""") 

for item in channel: 
    print (item) 

ich auf Debian Jessie bin

Antwort

0

Wenn Sie die Dokumentation zu lesen, wird die folgende definiert

def makegateway(self, spec=None): 
    """create and configure a gateway to a Python interpreter. 
    The ``spec`` string encodes the target gateway type 
    and configuration information. The general format is:: 

     key1=value1//key2=value2//... 

    If you leave out the ``=value`` part a True value is assumed. 
    Valid types: ``popen``, ``ssh=hostname``, ``socket=host:port``. 
    Valid configuration:: 

     id=<string>  specifies the gateway id 
     ***python=<path> specifies which python interpreter to execute*** 
     execmodel=model 'thread', 'eventlet', 'gevent' model for execution 
     chdir=<path> specifies to which directory to change 
     nice=<path>  specifies process priority of new process 
     env:NAME=value specifies a remote environment variable setting. 

    If no spec is given, self.defaultspec is used. 
    """ 

das heißt, Sie schreiben sollte:

gw = execnet.makegateway("popen//python=C:\\..\\jython2.7.0\\bin\\jython") 
+0

Vielen Dank, aber ich bin mit Linux. Pfad ist nicht notwendig. – Pablo