Hello, 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: "--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ 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 /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ 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 /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ 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) /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/all.py in <module>() 89 from sage.algebras.all import * 90 from sage.modular.all import * ---> 91 from sage.schemes.all import * 92 from sage.graphs.all import * 93 from sage.groups.all import * /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/schemes/all.py in <module>() 23 from jacobians.all import * 24 ---> 25 from hyperelliptic_curves.all import * 26 27 from plane_curves.all import * /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/schemes/hyperelliptic_curves/ all.py in <module>() ----> 1 2 3 from constructor import HyperellipticCurve 4 from hyperelliptic_generic import is_HyperellipticCurve 5 from kummer_surface import KummerSurface 6 from invariants import (igusa_clebsch_invariants, 7 absolute_igusa_invariants_kohel, /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/schemes/hyperelliptic_curves/ constructor.py in <module>() 9 #***************************************************************************** 10 ---> 11 from sage.schemes.generic.all import ProjectiveSpace 12 13 from hyperelliptic_generic import HyperellipticCurve_generic /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/schemes/generic/all.py in <module>() 2 3 from spec import Spec, is_Spec ----> 4 from affine_space import AffineSpace, is_AffineSpace 5 from algebraic_scheme import is_AlgebraicScheme 6 from ambient_space import is_AmbientSpace /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/schemes/generic/ affine_space.pyc in <module>() 22 from sage.misc.all import latex 23 ---> 24 import algebraic_scheme 25 26 import ambient_space /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/schemes/generic/ algebraic_scheme.pyc in <module>() 141 import affine_space 142 import projective_space --> 143 import toric_variety 144 import morphism 145 import scheme /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/schemes/generic/ toric_variety.py in <module>() 234 import sys 235 --> 236 from sage.geometry.cone import Cone, is_Cone 237 from sage.geometry.fan import Fan 238 from sage.matrix.all import matrix /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/geometry/cone.py in <module>() 172 import warnings 173 --> 174 from sage.combinat.posets.posets import FinitePoset 175 from sage.geometry.lattice_polytope import LatticePolytope 176 from sage.geometry.polyhedra import Polyhedron, Hasse_diagram_from_incidences /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/combinat/posets/posets.py in <module>() 22 from sage.structure.parent_base import ParentWithBase 23 from sage.rings.integer import Integer ---> 24 from sage.graphs.all import DiGraph 25 from sage.combinat.posets.hasse_diagram import HasseDiagram 26 from sage.combinat.posets.elements import * /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/graphs/all.py in <module>() 14 from sage.graphs.cliquer import * 15 from graph_database import graph_db_info ---> 16 from graph_editor import graph_editor 17 18 /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/graphs/graph_editor.py in <module>() 20 21 import sagenb.notebook.interact ---> 22 from sagenb.misc.support import EMBEDDED_MODE 23 24 /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ devel/sagenb/sagenb/misc/support.py in <module>() 561 # without the sage library present, e.g., in FEMhub. 562 try: --> 563 from sage.symbolic.all import Expression, SR 564 class AutomaticVariable(Expression): 565 """ /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 /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/symbolic/physical_constants.py in <module>() 427 428 unit_replace = { --> 429 'Hz':units.frequency.hertz, 430 'm':units.length.meter, 431 'K':units.temperature.kelvin, /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/symbolic/units.pyc in __getattr__(self, name) 1130 return self.__units[name] 1131 if len(unit_to_type) == 0: -> 1132 evalunitdict() 1133 try: 1134 v = self.__data[name] /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/symbolic/units.pyc in evalunitdict() 493 from sage.misc.all import sage_eval 494 for key, value in unitdict.iteritems(): --> 495 unitdict[key] = dict([(a,sage_eval(repr(b))) for a, b in value.iteritems()]) 496 497 # FEATURE IDEA: create a function that would allow users to add /home/eviatar/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/ local/lib/python2.6/site-packages/sage/misc/sage_eval.pyc in sage_eval(source, locals, cmds, preparse) 197 return locals['_sage_eval_returnval_'] 198 else: --> 199 return eval(source, sage.all.__dict__, locals) 200 201 AttributeError: 'module' object has no attribute 'all' Error importing ipy_profile_sage - perhaps you should run %upgrade? WARNING: Loading of ipy_profile_sage failed." 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. Thanks! -- 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