Ask Your Question

Directory problems

asked 2019-06-09 04:29:37 -0500

bd gravatar image

Hi everybody. I would like to create some kind of structure(packages) in sage. Let's say I have the following directory structure:

  • Main_Dir which contains:
    • subdirectories [Dir_A, Dir_B, ...,Test ]
      • Dir_A contains some sage files/classes
        • file1.sage, file2.sage. In file1.sage I have load('file2.sage')
      • My Test directory is the place where I would like to test all the functions I have created. It contains some test files
        • test1.sage, test2.sage, ...., assemble_all.sage.
          • In test1.sage I have the line load('../Dir_A/file1.sage').

And here I got the following error: raise IOError('did not find file %r to load or attach' % filename) IOError: did not find file './file2.sage' to load or attach

I hope somebody has an answer to this kind of problems.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-06-09 08:52:31 -0500

vdelecroix gravatar image

If you want to create a package never ever use attach. You should create a Python module (the one you use when you write "import X") and could have a look at

edit flag offensive delete link more


Relatedly, there is a ticket about making .sage modules importable through the Python import system, so with this it would be possible to make Python packages that nevertheless include .sagesources: I believe it would not be too hard to do, but alas nobody with the experience to do it has had time to take it up. It will also be easier to do as a Python 3 only feature just because otherwise doing so would require two more-or-less separate implementations.

Iguananaut gravatar imageIguananaut ( 2019-06-12 04:50:03 -0500 )edit

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


Asked: 2019-06-09 04:29:37 -0500

Seen: 46 times

Last updated: Jun 09