On Wed, Dec 29, 2021 at 10:11 AM Aleksandra Pietrzkiewicz <aleksandra.mazur...@gmail.com> wrote: > > Hi, > I have an issue with compatibility, I think. > I want to call some functions from sage script (but saved as .py) from > another python3 script. > so my matrix.py is like: > > #!/usr/bin/sage > from sage.all import * > > def my_field(dim): > return GF(2**dim, 'a') > #and more here - like creating special matrixes >
This would be fine to run as ./matrix.py (assuming your Sage is indeed /usr/bin/sage, else you need to replace this with the correct path). If you just want to import is as a Python module then you don't need the 1st #! line at all. > and I want to call it from python3 script (smth.py) like: > import matrix.py > M = gen_matrix(my_field(4)) > > > but I do always get some issues, like: ModuleNotFoundError or alike, because > I start with: > python3 smth.py and_some_args. this most likely means that python3 does not know anything about Sage, i.e. the latter has its own, different, installation of Python3, which you can start as sage --python HTH Dmitrii > > > Did someone ever had some similar issue? > I'd appreciate some help. > > -- > 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/3485945f-97d8-4a06-9955-3cee291b345en%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/CAAWYfq37neN5RgVj-ut3Q4EGSHESwhgrb7umtst4XO4vgbKREQ%40mail.gmail.com.