Ask Your Question
0

Directory problems

asked 2019-06-09 11:29:37 +0100

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
2

answered 2019-06-09 15:52:31 +0100

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

Comments

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: https://trac.sagemath.org/ticket/27074 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 11:50:03 +0100 )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

Stats

Asked: 2019-06-09 11:29:37 +0100

Seen: 606 times

Last updated: Jun 09 '19