Ask Your Question
1

Suppress automatically generated Python files when running Sage script

asked 7 years ago

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!

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 7 years ago

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.
Preview: (hide)
link

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: 7 years ago

Seen: 452 times

Last updated: Jul 24 '17