| 1 | initial version |
Here is a short recipe, assuming that your file is named your_file.sage:
From a standard terminal, type sage -sh. Within this new shell, whose path contains the sage scripts directory, type:
sage-preparse your_file.sage
A file named your_file.sage.py will appear.
Edit it and remove (or comment) the from sage.all_cmdline import * statement.
Now, install pyflakes for Python 2 [this will soon be Python 3, on Debian, the corresponding package will be pyflakes3].
Then run pyflakes your_file.sage.py from a standard terminal. You will get a lot of lines of the kind:
your_file.sage.py:XX: undefined name 'Blah'
For each such Blah, in a Sage session, run:
sage: import_statements('Blah')
Sage will give you the line to add at the beginning of your_file.sage.py.
For example, if pyflakes returns:
your_file.sage.py:XXX: undefined name 'Integer'
The command
sage: import_statements('Integer')
gives
from sage.rings.integer import Integer
which you have to add to the beginning of your_file.sage.py.
| 2 | No.2 Revision |
Here is a short recipe, assuming that your file is named your_file.sage:.
From a standard terminal, type type:
sage. Within this new shell, whose path contains the sage scripts directory, type:-shsage-preparse -preparse your_file.sageA file named
your_file.sage.pywill appear.Edit it and remove (or comment) the
from sage.all_cmdline import *statement.Now, install
pyflakesfor Python 2 [this will soon be Python 3, on Debian, the corresponding package will bepyflakes3].Then run
pyflakes your_file.sage.pyfrom a standard terminal. You will get a lot of lines of the kind:your_file.sage.py:XX: undefined name 'Blah'For each such
Blah, in a Sage session, run:sage: import_statements('Blah')Sage will give you the line to add at the beginning of
your_file.sage.py.For example, if pyflakes returns:
your_file.sage.py:XXX: undefined name 'Integer'The command
sage: import_statements('Integer')gives
from sage.rings.integer import Integerwhich you have to add to the beginning of
your_file.sage.py.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.