Dear All,
I was writing some code for sage and ran into trouble. The code was
working just fine when it was a standalone function. Then I tried to
add it to a pyx file (sage/rings/fraction_field_element.pyx to be
precise) and ran into trouble. Somewhere in the code I would like to
use the command PolynomialRing, so I had to import it for else it
wouldn't build. So I added the line
from sage.rings.polynomial.polynomial_ring_constructor import
PolynomialRing
to the file. After having done this sage will build, but when running
sage I get into trouble. I have no idea about how importing and stuff
works in python/cython so if someone could help me with this I would
be very glad.
Below you will find the trouble I run in to when starting sage:
----------------------------------------------------------------------
| Sage Version 4.4.4, Release Date: 2010-06-23 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (69, 0))
---------------------------------------------------------------------------
ImportError Traceback (most recent call
last)
/Applications/sage/local/lib/python2.6/site-packages/IPython/
ipmaker.pyc in force_import(modname)
64 reload(sys.modules[modname])
65 else:
---> 66 __import__(modname)
67
68
/Applications/sage/local/bin/ipy_profile_sage.py in <module>()
5 preparser(True)
6
----> 7 import sage.all_cmdline
8 sage.all_cmdline._init_cmdline(globals())
9
/Applications/sage/local/lib/python2.6/site-packages/sage/
all_cmdline.py in <module>()
12 try:
13
---> 14 from sage.all import *
15 from sage.calculus.predefined import x
16 preparser(on=True)
/Applications/sage/local/lib/python2.6/site-packages/sage/all.py in
<module>()
62 get_sigs()
63
---> 64 from sage.misc.all import * # takes a while
65
66 from sage.misc.sh import sh
/Applications/sage/local/lib/python2.6/site-packages/sage/misc/all.py
in <module>()
68 from sage_eval import sage_eval, sageobj
69
---> 70 from sage_input import sage_input
71
72 from cython import cython_lambda, cython_create_local_so
/Applications/sage/local/lib/python2.6/site-packages/sage/misc/
sage_input.py in <module>()
161 """
162
--> 163 from sage.misc.functional import parent
164 import math
165
/Applications/sage/local/lib/python2.6/site-packages/sage/misc/
functional.py in <module>()
36
37
---> 38 from sage.rings.complex_double import CDF
39 from sage.rings.real_double import RDF, RealDoubleElement
40
/Applications/sage/local/bin/complex_double.pyx in init
sage.rings.complex_double (sage/rings/complex_double.c:14319)()
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
complex_field.pyc in ComplexField(prec, names)
84 if not C is None:
85 return C
---> 86 C = ComplexField_class(prec)
87 cache[prec] = weakref.ref(C)
88 return C
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
complex_field.pyc in __init__(self, prec)
184 ParentWithGens.__init__(self, self._real_field(),
('I',), False, category = Fields())
185 # self._populate_coercion_lists_()
--> 186
self._populate_coercion_lists_(coerce_list=[complex_number.RRtoCC(self._real_field(),
self)])
187
188 def __reduce__(self):
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
complex_number.so in sage.rings.complex_number.RRtoCC.__init__ (sage/
rings/complex_number.c:13971)()
/Applications/sage/local/lib/python2.6/site-packages/sage/categories/
map.so in sage.categories.map.Map.__init__ (sage/categories/map.c:1951)
()
/Applications/sage/local/lib/python2.6/site-packages/sage/categories/
homset.pyc in Hom(X, Y, category)
150 # For the moment, this is the category, for compatibility
with the current implementations
151 # of Homset in rings, schemes, ...
--> 152 H = category.hom_category().parent_class(X, Y, category =
category)
153
154 ##_cache[key] = weakref.ref(H)
/Applications/sage/local/lib/python2.6/site-packages/sage/categories/
rings.pyc in __new__(cls, X, Y, category)
115 <class
'sage.rings.number_field.morphism.CyclotomicFieldHomset_with_category'>
116 """
--> 117 from sage.rings.homset import RingHomset
118 return RingHomset(X, Y, category = category)
119
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
homset.pyc in <module>()
15
16 import morphism
---> 17 import quotient_ring
18
19 def is_RingHomset(H):
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
quotient_ring.pyc in <module>()
30 import commutative_ring
31 import ideal
---> 32 import sage.rings.polynomial.multi_polynomial_ideal
33 import sage.structure.parent_gens
34 from sage.interfaces.all import singular as singular_default,
is_SingularElement
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
polynomial/multi_polynomial_ideal.py in <module>()
241
242 from sage.rings.integer_ring import ZZ
--> 243 import sage.rings.polynomial.toy_buchberger as toy_buchberger
244 import sage.rings.polynomial.toy_variety as toy_variety
245 import sage.rings.polynomial.toy_d_basis as toy_d_basis
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
polynomial/toy_buchberger.py in <module>()
144
145 from sage.misc.misc import get_verbose
--> 146 from sage.rings.arith import LCM
147 from sage.structure.sequence import Sequence
148
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
arith.py in <module>()
26 from sage.interfaces.all import gp
27 from sage.misc.misc import prod, union
---> 28 from sage.rings.fraction_field_element import
is_FractionFieldElement
29
30 import fast_arith
/Applications/sage/local/bin/fraction_field_element.pyx in init
sage.rings.fraction_field_element (sage/rings/fraction_field_element.c:
10889)()
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
polynomial/polynomial_ring_constructor.py in <module>()
42
43 from sage.rings.integer import Integer
---> 44 from sage.rings.finite_rings.integer_mod_ring import
is_IntegerModRing
45
46 _cache = {}
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/
finite_rings/integer_mod_ring.py in <module>()
69 import weakref
70
---> 71 from sage.rings.arith import is_prime, factor, CRT_basis, LCM,
prime_divisors, euler_phi
72 import sage.rings.commutative_ring as commutative_ring
73 import sage.rings.field as field
ImportError: cannot import name is_prime
Error importing ipy_profile_sage - perhaps you should run %upgrade?
WARNING: Loading of ipy_profile_sage failed.
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org