Hi Dima,

On Mon, Sep 6, 2010 at 11:26 PM, Dima Pasechnik <[email protected]> wrote:
> What is going on? This is with
>  Sage Version 4.5.3.rc0, Release Date: 2010-08-30

The problem lies with typing in Python. Any file with the extension
".py" is interpreted by Sage as a Python module and is loaded in/read
as such without any preparsing. Note that at the Python shell you
would get this:

sage: version()
'Sage Version 4.5.2, Release Date: 2010-08-05'
sage: !python
Python 2.6.4 (r264:75706, Aug 13 2010, 15:30:25)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 3 / 2
1


> Any tips how to fix this?

One way to overcome the above problem is to rename your file to have
the extension ".sage". That way, such a file would be read in and
preparsed. Here's an example:

sage: !cat demo.py
dat = [[6,3,3,4,1,3/2], [6,3,3,4,1,1]]
print dat
sage: load("demo.py")
[[6, 3, 3, 4, 1, 1], [6, 3, 3, 4, 1, 1]]
sage:
sage: !cat demo2.sage
dat = [[6,3,3,4,1,3/2], [6,3,3,4,1,1]]
print dat
sage: load("demo2.sage")
[[6, 3, 3, 4, 1, 3/2], [6, 3, 3, 4, 1, 1]]

-- 
Regards
Minh Van Nguyen

-- 
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
URL: http://www.sagemath.org

Reply via email to