ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 29 Oct 2015 10:29:57 +0100How can i use multiple sage worksheet in the cloud?https://ask.sagemath.org/question/30303/how-can-i-use-multiple-sage-worksheet-in-the-cloud/Hello,
Since a few days i'm using the cloud version of sagemath.
I have made two different worksheet with defined function in them so far.
Now i want to make a program which uses functions of both worksheets.
I really have no idea how i can use the function of a worksheet(.sagews file) in another worksheet.
I've tried to convert the sagews file into a sage file and attach it but that didnt work. i'm getting the following error: "NameError: name 'Integer' is not defined".
Can someone tell me how to fix this?
thanks in advance
Wed, 28 Oct 2015 09:26:00 +0100https://ask.sagemath.org/question/30303/how-can-i-use-multiple-sage-worksheet-in-the-cloud/Answer by slelievre for <p>Hello,</p>
<p>Since a few days i'm using the cloud version of sagemath.
I have made two different worksheet with defined function in them so far.
Now i want to make a program which uses functions of both worksheets.</p>
<p>I really have no idea how i can use the function of a worksheet(.sagews file) in another worksheet.
I've tried to convert the sagews file into a sage file and attach it but that didnt work. i'm getting the following error: "NameError: name 'Integer' is not defined".</p>
<p>Can someone tell me how to fix this?</p>
<p>thanks in advance</p>
https://ask.sagemath.org/question/30303/how-can-i-use-multiple-sage-worksheet-in-the-cloud/?answer=30304#post-id-30304Create a text file with a `.py` or `.sage` extension, put in that file the code
you want to reuse, and then load, runfile or attach that file in the
Sage notebook worksheet (.sws) or SageMathCloud Sage worksheet (.sagews)
or Jupyter notebook worksheet (.ipynb).
So for instance, in your SageMathCloud project, create a file `mycode.sage`,
put in that file all the functions you want to reuse (you can copy-paste them
from your initial `.sagews` worksheet), and then open a worksheet, say either
`playwithmycode.sagews` or `playwithmycode.ipynb` (in that case select
the Sage kernel from the `Kernel > Change kernel` menu item), and there
you can load or runfile or attach `mycode.sage` and use all the functions
that are defined there.
Wed, 28 Oct 2015 10:15:48 +0100https://ask.sagemath.org/question/30303/how-can-i-use-multiple-sage-worksheet-in-the-cloud/?answer=30304#post-id-30304Comment by Geurt for <p>Create a text file with a <code>.py</code> or <code>.sage</code> extension, put in that file the code
you want to reuse, and then load, runfile or attach that file in the
Sage notebook worksheet (.sws) or SageMathCloud Sage worksheet (.sagews)
or Jupyter notebook worksheet (.ipynb).</p>
<p>So for instance, in your SageMathCloud project, create a file <code>mycode.sage</code>,
put in that file all the functions you want to reuse (you can copy-paste them
from your initial <code>.sagews</code> worksheet), and then open a worksheet, say either
<code>playwithmycode.sagews</code> or <code>playwithmycode.ipynb</code> (in that case select
the Sage kernel from the <code>Kernel > Change kernel</code> menu item), and there
you can load or runfile or attach <code>mycode.sage</code> and use all the functions
that are defined there.</p>
https://ask.sagemath.org/question/30303/how-can-i-use-multiple-sage-worksheet-in-the-cloud/?comment=30317#post-id-30317When using 'attach' i got some problems with my global variables ("NameError: name 'Integer' is not defined"). Instead i use 'load' now, this works fine. It all works now. Thanks!Wed, 28 Oct 2015 14:56:36 +0100https://ask.sagemath.org/question/30303/how-can-i-use-multiple-sage-worksheet-in-the-cloud/?comment=30317#post-id-30317Comment by slelievre for <p>Create a text file with a <code>.py</code> or <code>.sage</code> extension, put in that file the code
you want to reuse, and then load, runfile or attach that file in the
Sage notebook worksheet (.sws) or SageMathCloud Sage worksheet (.sagews)
or Jupyter notebook worksheet (.ipynb).</p>
<p>So for instance, in your SageMathCloud project, create a file <code>mycode.sage</code>,
put in that file all the functions you want to reuse (you can copy-paste them
from your initial <code>.sagews</code> worksheet), and then open a worksheet, say either
<code>playwithmycode.sagews</code> or <code>playwithmycode.ipynb</code> (in that case select
the Sage kernel from the <code>Kernel > Change kernel</code> menu item), and there
you can load or runfile or attach <code>mycode.sage</code> and use all the functions
that are defined there.</p>
https://ask.sagemath.org/question/30303/how-can-i-use-multiple-sage-worksheet-in-the-cloud/?comment=30335#post-id-30335I know that 'attach' was broken for quite a while, i.e. it would load once but not reload when the document was saved. I am not sure this is fixed.Thu, 29 Oct 2015 10:29:57 +0100https://ask.sagemath.org/question/30303/how-can-i-use-multiple-sage-worksheet-in-the-cloud/?comment=30335#post-id-30335