I would guess you have a circular import issue going on here when you  
try to put it in the Sage library. Unfortunately, I don't have an  
easy solution other than trying to be very careful about what you are  
importing in your files.

On Mar 18, 2009, at 10:04 AM, Simon King wrote:

>
> Dear folks,
>
> I implemented "symmetric polynomial rings" and "symmetric ideals" in
> two python files ``symmetric_polynomial.py`` and
> ``symmetric_ideal.py``. When I attach ``symmetric_polynomial.py``,
> everything works just fine (the class from the second file is imported
> by the first).
>
> The problems start when I copy these files into sage.rings.polynomial,
> and update all.py by adding the line
> from sage.rings.polynomial.symmetric_polynomial import
> SymmetricPolynomialRing
>
> After sage -br, I obtain:
> ImportError                               Traceback (most recent call
> last)
>
> /home/king/SAGE/devel/sage-3.2.3/local/lib/python2.5/site-packages/
> IPython/ipmaker.pyc in force_import(modname)
> ...
> ImportError: cannot import name PolynomialRing
> Error importing ipy_profile_sage - perhaps you should run %upgrade?
> WARNING: Loading of ipy_profile_sage failed.
>
>
> The imports in symmetric_polynomial.py are:
>
> import sage
> import sage.all
> from sage.rings.polynomial.polynomial_ring_constructor import
> PolynomialRing
> from sage.rings.integer_ring import ZZ
> from sage.structure.element import RingElement
> from sage.rings.ring import CommutativeRing, Ring
> from sage.rings.commutative_ring import is_CommutativeRing
> from sage.structure.all import Parent, SageObject
> from sage.structure.factory import UniqueFactory
> from sage.rings.polynomial.infinite_polynomial import
> InfinitePolynomialRing_class
> from sage.misc.cachefunc import cached_method
> from sage.misc.misc import prod
> from sage.combinat.permutation import Permutation
> import copy, operator
>
> Interestingly, a previous version of that file was successfully
> installed into sage.rings.polynomial, and it imported:
>
> from sage.rings.polynomial.polynomial_ring_constructor import
> PolynomialRing
> from sage.rings.integer_ring import ZZ
> from sage.structure.element import RingElement
> from sage.rings.ring import Ring
> from sage.structure.all import Parent, SageObject
> from sage.structure.factory import UniqueFactory
> from sage.misc.cachefunc import cached_method
> import copy, operator
>
> Can you explain to me why it works to attach the file, while an import
> by sage/rings/polynomial/all.py fails?
>
> Thank you very much in advance
>        Simon
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to