That's exactly what I want (hiding sources codes from users). 

I'm teaching a class where the students need to implement some algorithms 
on graphs but I would like to distribute those functions in advance so that 
they can play with it and see what's the expected output before writing 
their owns. 

So how can I save those pyc files generated by sage separately and have 
them run inside a session?
Thanks in advance


On Wednesday, October 16, 2019 at 12:02:00 PM UTC-7, Dima Pasechnik wrote:
>
> On Wed, Oct 16, 2019 at 6:18 PM pong <wypo...@gmail.com <javascript:>> 
> wrote: 
> > 
> > I have a bunch of old scripts in .sage files. They were compiled into 
> .pyc files years ago. 
>
> *.sage files are preparsed by sage preparser, and converted into *.py 
> files. 
> Conversion into *.pyc files is done automatically, as *.py files are 
> loaded into Sage's Python interpreter. 
>
> One cannot load() or attach() *.pyc files, as far as I know - but why 
> would you need this? 
> (unless you want to hide the source of your *.sage scripts from the user) 
>
> HTH 
> Dima 
>
> > 
> > Unfortunately, I only remember that I ran sage --preparse on the .sage 
> files and got them into .py files but forgot what next. 
> > 
> > I tried import py_compile in sage then ran py_compile.compile('xxx.py') 
> which gave me a .pyc file but I couldn't load it or attach it to sage. 
> > 
> > I understand one can change the file extension to .spyx and have sage to 
> compile it by loading it into a session but I would like the pyc files by 
> themselves. 
> > 
> > Can I get some help on this? 
> > 
> > -- 
> > 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-s...@googlegroups.com <javascript:>. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/f28af744-043a-4100-b965-ce5642887512%40googlegroups.com.
>  
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/50e388e8-49e4-41f7-b042-708700c3e653%40googlegroups.com.

Reply via email to