thanks a lot,
this give's me some more info i can use in determining the architecture.
I will certainly look into the option os.fork.
Richard
On 1/18/08, Barry Rowlingson <[EMAIL PROTECTED]> wrote:
> richard mendes wrote:
>
> > The question i have is how does rpy handle multithreads.
> >
> > What i've seen till now is that a r object is created when importing
> > the rpy library. how does this react to multithreads.
>
> Those are fairly vague questions, so I'll answer the specifics:
>
> > Is that r object connected to one R session ?
>
> Yes.
>
> > Is there a way to create a new r object ?
>
> You can try! Doing 'from rpy import r' just runs rpy.py, and that
> defines a class 'R' and creates an object called 'r' of that class which
> is then imported into the caller. So you can try and make another by
> creating another instance:
>
> >>> import rpy
> >>> r2=rpy.R()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "C:\Python25\Lib\site-packages\rpy.py", line 286, in __init__
> _rpy.r_init(HAS_NUMERIC);
> RuntimeError: Only one R object may be instantiated per session
>
> So I guess that's a no. That error is coming from the C code, so I
> don't know how fundamental it is or how difficult it would be to make it
> work...
>
> > what happens to the r object if i just make a new object of the class
> > that calls the rpy library. Would that create a new R session ?
>
> Fraid not:
>
> >>> from rpy import r
> >>> r.assign('x',999)
> 999
> >>> r.ls()
> 'x'
> >>> r2=r
> >>> r2.ls()
> 'x'
>
> it's the same session.
>
> > If someone knows the answers to these questions it would help me a
> > lot, and save me some time writing tests to find this out.
>
> So I think that definitely within a single thread there can be only
> one, and probably across multiple threads too. However if you use
> os.fork() you can get a new R session...
>
> Barry
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> rpy-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list