You need to give the full path if you are in the notebook. If you strongly need to not to give the full path you could run the command $mkdir (where your files are)/sagenotebook $sage -notebook directory="Where your files are/sagenotebook"
The disadvantage is that this will create another server, and you won't be able to see the worksheets you had in .sage/notebook this was the discussion in http://groups.google.com/group/sage-support/browse_thread/thread/37795251481402a1/552ac0654c85f4ec?lnk=gst&q=attach#552ac0654c85f4ec This kind of behaviour is the reason for the ticket in http://trac.sagemath.org/sage_trac/ticket/5169 Hope this helps -Adrian. On Feb 6, 10:40 am, ricardomayerb <ricardomay...@gmail.com> wrote: > Dear all, > > I'm trying to attach a python script. I'm probably doing somethign > wrong, but the weird thing is that what I do works for the command > line but not from the notebook. Let me show you. > > This works: > ---------------------------------------------------------------------- > | Sage Version 3.2.3, Release Date: 2009-01-05 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > sage: os.getcwd() > '/home/ricardo/sage-3.2.2' > sage: os.chdir('/media/disk/thesiswork/thesis2009/sage/src/ > sympy_files') > sage: os.getcwd > () > '/media/disk/thesiswork/thesis2009/sage/src/sympy_files' > sage: attach thesis_sympy_2009.py > > So no problem there. > > but this doesn't: > > sage: notebook() > The notebook files are stored in: /home/ricardo/.sage//sage_notebook > > os.chdir('/media/disk/thesiswork/thesis2009/sage/src/sympy_files') > > attach thesis_sympy_2009.py > --->Error attaching /home/ricardo/.sage/thesis_sympy_2009.py -- file > not > found > > os.getcwd() > --->'/home/ricardo/.sage/sage_notebook/worksheets/admin/4/cells/3' > > ...so obviously os.chdir didn't change the dir where the notebook > looks for files (mybe is not supposed to...). Thus, I tried using an > absolute path instead: > > attach /media/disk/thesiswork/thesis2009/sage/src/sympy_files/ > thesis_sympy_2009.py > ---> Syntax Error: > attach > /media/disk/thesiswork/thesis2009/sage/src/sympy_files/ > thesis_sympy_2009\ > .py > > how could I use absolute paths with attach inside a notebook? Is there > a workaround? > > I also tried setting the variable DIR to /media/disk/thesiswork/ > thesis2009/sage/src/sympy_files/ and then using attach > thesis_sympy_2009.py but it didn't work either > > thanks in advance for your help > > Ricardo --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---