If I create a simple Sage script and call it "script.sage", then running 
"sage script.sage" works fine.  But if I call it "new.sage", it doesn't.  
Why?

Script:

    def f(i):
        return i

    f(10)

Error:

Traceback (most recent call last):
  File "new.py", line 2, in <module>
    from sage.all_cmdline import *   # import sage library
  File 
"/Applications/sage/local/lib/python2.6/site-packages/sage/all_cmdline.py", 
line 14, in <module>
    from sage.all import *
  File "/Applications/sage/local/lib/python2.6/site-packages/sage/all.py", 
line 60, in <module>
    import twisted.persisted.styles
  File 
"/Applications/sage/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-macosx-10.6-i386.egg/twisted/persisted/styles.py",
 
line 22, in <module>
    from twisted.python import log
  File 
"/Applications/sage/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-macosx-10.6-i386.egg/twisted/python/log.py",
 
line 19, in <module>
    from twisted.python import util, context, reflect
  File 
"/Applications/sage/local/lib/python2.6/site-packages/Twisted-9.0.0-py2.6-macosx-10.6-i386.egg/twisted/python/util.py",
 
line 5, in <module>
    import os, sys, hmac, errno, new, inspect, warnings
  File "/Users/palmieri/Desktop/new.py", line 3, in <module>
    _sage_const_10 = Integer(10)
NameError: name 'Integer' is not defined

Other symptoms: 

 - if it's called "new.sage", then files "new.py" *and* "new.pyc" are 
created; the pyc file is not created if it's called "script.sage"
 - once I've tried running "sage new.sage", so that the files new.py and 
new.pyc are present, running "sage script.sage" from the same directory 
produces the same error.

So somewhere, is "new" being imported?  Is the current working directory in 
the module load path?

Are there other bad names for scripts?

-- 
John

-- 
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