Ask Your Question
1

Suppress automatically generated Python files when running Sage script

asked 2017-07-24 20:44:17 +0100

Vincent Russo gravatar image

Hello,

I'm curious if it is possible to stop Sage from automatically generating corresponding Python files. For instance, if I run a sage script test.sage, then after running sage test.sage, I'll get an automatically generated file called test.sage.py. Is there any way to suppress the generation of this file? I tried to take a look in the documentation, but I couldn't find anything.

Thanks again!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-07-24 21:44:26 +0100

vdelecroix gravatar image

You can not avoid it. The way it works is

  1. Convert the .sage file into a .py file
  2. Execute the .py file

If you don't want extra files to be created, just use .py files directly. The .sage hides some work for you. The conversion .sage -> .py essentially consists in

  • writing the line from sage.all import * at the begining of the file
  • turn on the preparser. For example if you write 123 it will be understood as a Sage integer and not a Python integer.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-07-24 20:44:17 +0100

Seen: 424 times

Last updated: Jul 24 '17