Renato Alves wrote, On 06/25/08 13:58:
> I just tried it myself and couldn't understand how it works ...
> 
> I got the same error as you, but even more, after two or three refreshes 
> on the page, I get:
> 
> File "/var/tmp/modpython/mptest.py", line 2, in <module>
> import rpy
> 
> File "/usr/lib/python2.5/site-packages/rpy.py", line 346, in <module>
> r = R()
> 
> File "/usr/lib/python2.5/site-packages/rpy.py", line 286, in __init__
> _rpy.r_init(HAS_NUMERIC);
> 
> RuntimeError: Only one R object may be instantiated per session

I get the same. I assume that an R object is partly created with the first try, 
which then prevents any further attempts. So the RuntimeError most likely goes 
away if the first problem (RPy_Exception: R Function "get" not found) can be 
solved.

Christof

> 
> So I guess you can't plainly import rpy from within modpython due to the 
> way sessions are managed.
> 
> About the get problem I have no clue either...
> 
> Quoting Christof Winter on 06/25/2008 08:53 AM:
>> Hi Renato,
>>
>> sorry for the late reply, I hadn't subscribed for the mailing list 
>> until now.
>> I tried the import rpy, it gives exactly the same error message.
>>
>> The use of from rpy import * is documented, e.g. at
>> http://rpy.sourceforge.net/rpy/doc/rpy_html/Small-example.html#Small-example 
>>
>>
>> Cheers,
>> Christof
>>
>>
>> Re: [Rpy] rpy and mod_python problem
>> From: Renato Alves <[EMAIL PROTECTED]> - 2008-06-12 16:13
>> It's not a good python practice to use:
>>
>> from somewhere import *
>>
>> Instead consider using:
>>
>> from somewhere import function1, function2, function3 ... (as needed)
>>
>> or simply:
>>
>> import rpy
>>
>>
>> In the last case you will be using "rpy.r" instead of "r".
>>
>> Can you test if this works for your mod_python setup?
>>
>>
>> Quoting Christof Winter on 06/11/2008 08:57 PM:
>>> I tried to include use rpy within a Python script that runs on a 
>> mod_python
>>> Apache server. Upon import with from rpy import *, I get
>>>
>>> RPy_Exception: R Function "get" not found
>>>
>>> The full error stack trace is pasted below. Any ideas? There was a 
>> similar post
>>> concerning django, with the same error message, filed as 
>> (rpy-Bugs-1772975).
>>> I am running rpy version 1.0.4 with R version 2.7.0 (2008-04-22) and 
>> Python
>>> 2.5.2 on Debian Linux.
>>>
>>> Christof
>>>
>>>
>>>
>>> Traceback (most recent call last):
>>>
>>> File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 
>> 1537, in
>>> HandlerDispatch
>>> default=default_handler, arg=req, silent=hlist.silent)
>>>
>>> File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 
>> 1229, in
>>> _process_target
>>> result = _execute_target(config, req, object, arg)
>>>
>>> File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 
>> 1128, in
>>> _execute_target
>>> result = object(arg)
>>>
>>> File "/usr/lib/python2.5/site-packages/mod_python/publisher.py", 
>> line 204, in
>>> handler
>>> module = page_cache[req]
>>>
>>> File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 
>> 1059, in
>>> __getitem__
>>> return import_module(req.filename)
>>>
>>> File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 
>> 296, in
>>> import_module
>>> log, import_path)
>>>
>>> File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 
>> 680, in
>>> import_module
>>> execfile(file, module.__dict__)
>>>
>>> File "/var/www/testing/myscript.py", line 19, in <module>
>>> from rpy import *
>>>
>>> File "/usr/lib/python2.5/site-packages/rpy.py", line 346, in <module>
>>> r = R()
>>>
>>> File "/usr/lib/python2.5/site-packages/rpy.py", line 289, in __init__
>>> self.get = _rpy.get_fun('get') # this must happen before any calls 
>> to self
>>> or its methods!
>>>
>>> RPy_Exception: R Function "get" not found
>>>
>>>
>>>
>>>
>> -------------------------------------------------------------------------
>>> Check out the new SourceForge.net Marketplace.
>>> It's the best place to buy or sell services for
>>> just about anything Open Source.
>>> http://sourceforge.net/services/buy/index.php
>>> _______________________________________________
>>> rpy-list mailing list
>>> [EMAIL PROTECTED]
>>> https://lists.sourceforge.net/lists/listinfo/rpy-list
>>>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to