Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_49.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("QTEgPSBsb2FkKCIvRGVza3RvcC9hYmMudHh0Iik="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/tmp/tmpgD_ocu/___code___.py", line 2, in <module>
exec compile(u'A1 = load("/Desktop/abc.txt")
File "", line 1, in <module>
File "sage_object.pyx", line 862, in sage.structure.sage_object.load (sage/structure/sage_object.c:9317)
IOError: [Errno 2] No such file or directory: '/Desktop/abc.txt.sobj'
On Oct 20, 2014 1:20 AM, "John Cremona" <john.c...@gmail.com> wrote:
>
> On 19 October 2014 20:02, William Stein <wst...@gmail.com> wrote:
> > On Sun, Oct 19, 2014 at 4:52 AM, Santanu Sarkar
> > <sarkar.sa...@gmail.com> wrote:
> >> I have a text file abc.txt in Desktop where I have written A=[1,2,3,4]. Is
> >> it possible
> >> to call this array A from Sage notebook?
> >>
> >> When I write the following in notebook,
> >>
> >> A1 = load("/Desktop/abc.txt")
> >
> > You could do this:
> >
> > exec preparse(open('/Desktop/abc.txt').read())
> >
> > or name your file abc.sage and do
> >
> > load('/Desktop/abc.sage')
> >
> > in the notebook (maybe), or
> >
> > %execfile /Desktop/abc.sage
> >
> > on the command line. (That one has to use %execfile and %load doesn't
> > work continues to be a change that I am unhappy with.)
>
> %runfile abc.sage
>
> works fine, that is what I use all the time. The extension has to be
> sage or py (or pyx or spyx or m but the would be read / parsed
> differently)
Thanks - I meant %runfile not %execfile. I find it hard to remember, which is yet another reason I am against removal of the more memorable %load that we had for years.
> differently)
Thanks - I meant %runfile not %execfile. I find it hard to remember, which is yet another reason I am against removal of the more memorable %load that we had for years.
>