commands not found when file extension is .txt but it works with .sage

13 views
Skip to first unread message

Tovo

unread,
Feb 28, 2023, 9:14:47 AM2/28/23
to sage-support
I have sage 9.5 on Ubuntu 22.04/22.10.
I have the following code inside my files

delta=simplicial_complexes.RandomComplex(4,1)
print(delta.facets())

If the file is named as test.sage, the program works fine.
If the file is named as test.txt, the program outputs
delta=simplicial_complexes.RandomComplex(4,1)
NameError: name 'simplicial_complexes' is not defined

Why does this happen?

Dima Pasechnik

unread,
Feb 28, 2023, 9:24:38 AM2/28/23
to sage-s...@googlegroups.com
this is because .sage files are pre-processed (turned into .py files,
roughly speaking) on the fly,
before being run.

HTH
Dima

> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/c0aa434d-f75f-486d-914a-1fcbeb90fdabn%40googlegroups.com.

Tovo

unread,
Feb 28, 2023, 10:31:12 AM2/28/23
to sage-support
Thanks for the explanation.
Reply all
Reply to author
Forward
0 new messages