well, pardon my italian (?), but it seems you haven't set the necessary
environment variables for that program.
try passing them as env={"GRASSDATA": "foo", "LOCATION": "bar"} to the
Popen call.

-tomer

-----------------------------------------------------------------

*Tomer Filiba*
tomerfiliba.com     <http://www.facebook.com/tomerfiliba>
<http://il.linkedin.com/in/tomerfiliba>

On Thu, Nov 13, 2014 at 3:54 PM, Luca Delucchi <[email protected]> wrote:

> Hi everybody,
>
> I'm quite new to rpyc and I'm not able to solve a problem. I have a class
> that it is using subprocess, if I run it from python it is working without
> problem but if I try to use it with rpyc it return me an error because it
> seems that subprocess it is not running properly.
>
> My class is like this
>
> class stemGRASS():
>
>      def __init__(self, pid, grassdatabase, location, grassbin, epsg):
>
>          startcmd = [grassbin, ' --config path']
>          p = subprocess.Popen(startcmd, shell=True, stdin=subprocess.PIPE,
> stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>          out, err = p.communicate()
>
>          if p.returncode != 0:
>              raise Exception("Error running GRASS")
>
>
>
> I tried both classic and services method but it return the error
>
>
> In [18]: %paste
>
> import rpyc
> conn = rpyc.classic.connect("localhost")
> conn.modules.sys.path.append('/home/lucadelu/.qgis2/python/plugins/STEM')
> gr = conn.modules.grass_stem.stemGRASS('123456',
> '/home/lucadelu/grassdata/', 'latlong', '/home/lucadelu/bin/grass70',
> '4326')
>
> ## -- End pasted text --
>
> ---------------------------------------------------------------------------
>
> Exception                                 Traceback (most recent call last
> )
>
> <ipython-input-18-5c76931ebae2> in <module>()
>       2 conn = rpyc.classic.connect("localhost")
>       3 conn.modules.sys.path.append(
> '/home/lucadelu/.qgis2/python/plugins/STEM')
> ----> 4 gr = conn.modules.grass_stem.stemGRASS('123456',
> '/home/lucadelu/grassdata/', 'latlong', '/home/lucadelu/bin/grass70',
> '4326')
>
> /usr/local/lib/python2.7/dist-packages/rpyc/core/netref.pyc in __call__(
> _self, *args, **kwargs)
>     194         def __call__(_self, *args, **kwargs):
>     195             kwargs = tuple(kwargs.items())
> --> 196             return syncreq(_self, consts.HANDLE_CALL, args, kwargs
> )
>     197         __call__.__doc__ = doc
>     198         return __call__
>
> /usr/local/lib/python2.7/dist-packages/rpyc/core/netref.pyc in syncreq(
> proxy, handler, *args)
>      69         raise ReferenceError('weakly-referenced object no longer
> exists')
>      70     oid = object.__getattribute__(proxy, "____oid__")
> ---> 71     return conn.sync_request(handler, oid, *args)
>      72
>      73 def asyncreq(proxy, handler, *args):
>
> /usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.pyc in
> sync_request(self, handler, *args)
>     439         isexc, obj = self._sync_replies.pop(seq)
>     440         if isexc:
> --> 441             raise obj
>     442         else:
>     443             return obj
>
> Exception: Errore eseguendo GRASS: Vanno settate tutte le variabili
> necessarie: GRASSDATA, LOCATION ed eseguibile
>
> ========= Remote Traceback (1) =========
>
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py",
> line 305, in _dispatch_request
>     res = self._HANDLERS[handler](self, *args)
>   File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py",
> line 535, in _handle_call
>     return self._local_objects[oid](*args, **dict(kwargs))
>   File "/home/lucadelu/.qgis2/python/plugins/STEM/grass_stem.py", line 66,
> in __init__
>     raise Exception("Errore eseguendo GRASS: Vanno settate tutte le "
> Exception: Error running GRASS
>
>
> someone can help me?
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "rpyc" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to