One solution to circular imports is to do one of the imports inside a
function, rather than at the top level.
David
On Thu, Jul 21, 2011 at 17:36, Eviatar <eviatarb...@gmail.com> wrote:

> I can't see how to solve this.
>
> I import units, which import sage_eval, which imports symbolic, which
> imports physical_constants; thus the circular import. How can this be
> solved? The only way I can see is to merge the units and
> physical_constants files, but they don't exactly go together.
>
>
> On Jul 21, 2:17 am, Eviatar <eviatarb...@gmail.com> wrote:
> > Oh, thanks, that helps. I guess I'll have to restructure the code.
> >
> > On Jul 21, 2:06 am, Burcin Erocal <bur...@erocal.org> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > On Thu, 21 Jul 2011 00:42:38 -0700 (PDT)
> >
> > > Eviatar <eviatarb...@gmail.com> wrote:
> > > > I am working on a physical constants module, but for whatever reason
> I
> > > > can't get it to correctly import the units module.
> >
> > > > I import the units class using "from units import units", but I get:
> >
> > > > <snip>
> >
> > > > /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/
> > > > local/lib/python2.6/site-packages/sage/symbolic/all.py in <module>()
> > > >      12 from units import units
> > > >      13
> > > > ---> 14 import physical_constants
> > > >      15
> > > >      16
> >
> > > > <snip backtrace>
> >
> > > > Is it a problem that physical_constants is imported in all.py along
> > > > with the units module? Because when I run the file using %run, there
> > > > is no error. I don't see what other way there is to do it though.
> >
> > > You introduce a circular import when you add the import statement for
> > > physical constants to sage/symbolic/all.py.
> >
> > > The first part of the traceback looks exactly like the one from #11116.
> > > I was just trying to clean up some of those dependencies. The patch
> > > attached to that ticket doesn't solve the problem there, but it might
> > > help you.
> >
> > >http://trac.sagemath.org/sage_trac/attachment/ticket/11116/trac_11116.
> ..
> >
> > > Cheers,
> > > Burcin
>
> --
> To post to this group, send an email to sage-devel@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to