On Tue, Feb 9, 2010 at 10:03 PM, Robert Bradshaw
<rober...@math.washington.edu> wrote:
> On Feb 9, 2010, at 12:29 PM, kcrisman wrote:
>
>>
>>
>> On Feb 9, 3:02 pm, William Stein <wst...@gmail.com> wrote:
>>>
>>> On Tue, Feb 9, 2010 at 10:17 AM, kcrisman <kcris...@gmail.com> wrote:
>>>>
>>>> Dear support,
>>>
>>>> Suppose I want to refer to a file in a notebook cell directory from
>>>> inside that cell.  How do I access that path 'easily'?
>>>> os.path.abspath('.') seems to not do what I expect, but just referring
>>>> directly to the file also raises an error.  I would use
>>>> Cell.directory() or Cell.id() but don't know how to get a reference to
>>>> the cell I am in that way either.
>>>
>>> What *precisely* do you really want to do.  The above question is too
>>> general.  In general you can't do the above, due to security
>>> restrictions.
>>>
>>
>> I want to get a reference to the cell.  This is related to my other
>> question (viewing graphics files). In one cell, I would like to do
>>
>> make_graphics_file('foo.png') # NOT a Sage object, a graphics file
>> view_graphics_file('foo.png') # the exact same graphics file I just
>> created
>>
>> The other support request was about what command (if any) might do the
>> second line in general, which Harald (sort of) answered.  This
>> question is just about how to access ...sage_notebook.sagenb/home/
>> admin/worksheet/xx/cells/yy/foo.png , which is more or less where such
>> a graphic lives - because even his idea doesn't work in the notebook,
>> at least not directly, without knowing the path (just 'foo.png' raises
>> an error for some reason).
>>
>> Maybe I should have concatenated the two questions into one, my
>> apologies - though I thought they were separately interesting enough
>> to not obscure them by putting them together.
>
>
> A good way to share files across cells is to use the DATA variable. This is
> a worksheet-level folder that the worksheet has read and write access to.
>
> make_graphics_file(DATA + 'foo.png')
> view_graphics_file(DATA + 'foo.png')
>
> BTW, is sagenb.org using the serverpool option?

Yes.

William

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to