Ask Your Question
0

How do I type path so sage/ubuntu finds my file?

asked 2023-04-17 21:03:56 +0200

9121717 gravatar image

updated 2023-04-18 22:50:26 +0200

This is a newbie, very basic question. I have installed sagemath on a windows computer using ubuntu. I want to load a file but I don't know where sage/ubuntu is looking for that file. So I get an error (below). How do I type the path so my file is found? Or maybe I can just save the somewhere different that makes things easy?

sage: load('C:\Documents\SAGE\example.sage')
<input>:1: DeprecationWarning: invalid escape sequence '\D'
<>:1: DeprecationWarning: invalid escape sequence '\D'
<ipython-input-20-514939547c9b>:1: DeprecationWarning: invalid escape sequence '\D'
  load('C:\Documents\SAGE\example.sage')
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-20-514939547c9b> in <module>
----> 1 load('C:\Documents\SAGE\example.sage')

/usr/lib/python3/dist-packages/sage/misc/persist.pyx in sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2647)()
    171
    172     if sage.repl.load.is_loadable_filename(filename):
--> 173         sage.repl.load.load(filename, globals())
    174         return
    175

/usr/lib/python3/dist-packages/sage/repl/load.py in load(filename, globals, attach)
    242             break
    243     else:
--> 244         raise IOError('did not find file %r to load or attach' % filename)
    245
    246     ext = os.path.splitext(fpath)[1].lower()

OSError: did not find file 'C:\\Documents\\SAGE\\example.sage' to load or attach
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-04-17 22:37:14 +0200

9121717 gravatar image

If anyone has this problem in the future... Sage starts looking in the Ubuntu folder (which now seems obvious), however I was not able to save there. I saved my file in Ubuntu\home\mysageusername\mysageFiles

So I type load('/home/mysageusername/mysageFiles/example.sage') and the sage code in example.sage output to command line.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2023-04-17 21:03:56 +0200

Seen: 102 times

Last updated: Apr 18 '23