mabshoff <[EMAIL PROTECTED]> writes:

> On Apr 5, 7:20 am, Nikos Apostolakis <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I am trying to use sage in a cgi script and every time I try to
>> import the sage libraries I keep getting the following error
>>
>> -------- 8< --------
>> Traceback (most recent call last):
>>   File "/usr/local/include/sage-2.10.2/local/bin/sage-eval", line 4,
>>   in <module>
>>     from sage.all import *
>>   File
>>   
>> "/usr/local/include/sage-2.10.2/local/lib/python2.5/site-packages/sage/all.py",
>>   line 53, in <module>
>>     from sage.misc.all       import *         # takes a while
>>   File
>>   
>> "/usr/local/include/sage-2.10.2/local/lib/python2.5/site-packages/sage/misc/all.py",
>>   line 1, in <module>
>>     from misc import (alarm, ellipsis_range, ellipsis_iter, srange,
>>   xsrange, sxrange, getitem,
>>   File
>>   
>> "/usr/local/include/sage-2.10.2/local/lib/python2.5/site-packages/sage/misc/misc.py",
>>   line 83, in <module>
>>     os.makedirs(DOT_SAGE)
>>   File "/usr/local/include/sage-2.10.2/local/lib/python2.5/os.py",
>>   line 172, in makedirs
>>     mkdir(name, mode)
>> OSError: [Errno 13] Permission denied: '/.sage/'
>> -------- >8 --------
>>
>> I guess that at some point sage tries to create a directory at "/"
>> and it doesn't have permisssion to.  
>
> Hi Nick,
>
> Sage checks for the exitence of $HOME/.sage and if it doesn't exist
> creates it. In your case $HOME seems to be empty.
>

Ok, I see.  But shouldn't $HOME be "/var/www"?  According to
/etc/passwd that's the home directory of the apache user.

I don't know if the following make sense but is it possible to
have some kind of global .sage directory for cases like this?
Something like `/etc/sage/'.  Is it really necessary for a user
to have a `~/.sage' directory in order to run a script that uses 
sage?

>> Is this a bug?  Any workarounds?
>
> It isn't a bug. To fix this we need to know more about your setup,
> i.e. which user the webserver runs as, which webserver you are using
> and so on. 

I've tried this with two setups, Debian unstable with apache2 and
Ubuntu 7.10 with thttpd, in both cases the distribution provided
packages. On the Debian box apache runs as `www-data', I don't have
access to the Ubuntu box right now but I used the standard setup in
both case since my knoweldge of this stuff is minimal.  Also in both 
machines sage has been install by the superuser at /usr/local/include.

This morning I played a bit more with this.  After creating a
directory "/.sage" with owner "www-data" and permissions 700 the cgi
scripts seem to work.  I am not sure that this is a good solution on
the long run though.  Are there any security (or other) issues that
could result from this hack?

Thaks,
Nikos

> Cheers,
>
> Michael


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to