First time here? Check out the FAQ!

Ask Your Question
0

Directory problems

asked 5 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 5 years ago

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

Preview: (hide)
link

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 ( 5 years ago )

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: 5 years ago

Seen: 719 times

Last updated: Jun 09 '19