Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

%attach misc.sage; a bug?

Hi!

I'm running sage 5.11 on linux. I have a file called misc.sage which %attach seems to not like very much. The problem seems to be the filename, since even an empty file or just a print statement in it produce the same reaction. Is this a bug? Is this present in 5.12 too?

sage: %attach misc.sage                                                                                                                                                                    [2/708]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-22-239b268dc29e> in <module>()
----> 1 get_ipython().magic(u'attach misc.sage')

/home/fidbc/._sys/opt/sage-5.11/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
   2134         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2135         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2136         return self.run_line_magic(magic_name, magic_arg_s)
   2137
   2138     #-------------------------------------------------------------------------

/home/fidbc/._sys/opt/sage-5.11/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
   2060                 args.append(sys._getframe(stack_depth).f_locals)
   2061             with self.builtin_trap:
-> 2062                 result = fn(*args)
   2063             return result
   2064

/home/fidbc/._sys/opt/sage-5.11/local/lib/python2.7/site-packages/sage/misc/sage_extension.pyc in attach(self, s)

/home/fidbc/._sys/opt/sage-5.11/local/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    189     # but it's overkill for just that one bit of state.
    190     def magic_deco(arg):
--> 191         call = lambda f, *a, **k: f(*a, **k)
    192
    193         if callable(arg):

/home/fidbc/._sys/opt/sage-5.11/local/lib/python2.7/site-packages/sage/misc/sage_extension.pyc in attach(self, s)
    118         """
    119         from sage.misc.preparser import load_wrap
--> 120         return self.shell.ex(load_wrap(s, attach=True))
    121
    122     @line_magic

/home/fidbc/._sys/opt/sage-5.11/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in ex(self, cmd)
   2378         """Execute a normal python statement in user namespace."""
   2379         with self.builtin_trap:
-> 2380             exec cmd in self.user_global_ns, self.user_ns
   2381
   2382     def ev(self, expr):

<string> in <module>()

/home/fidbc/._sys/opt/sage-5.11/local/lib/python2.7/site-packages/sage/misc/preparser.pyc in load(filename, globals, attach)
   1721                 return
   1722
-> 1723     filename = filename.strip()
   1724
   1725     if filename.lower().startswith(('http://', 'https://')):

AttributeError: 'module' object has no attribute 'strip'