OK, this is now trac ticket  #5206.

-M. Hampton

On Feb 8, 4:09 am, ricardomayerb <[email protected]> wrote:
> Thanks, Adrian, Marshall.
>
> I can confirm that it has something to do with carriage return. I can
> summarize things this way:
>
> --> using quotes around the path didn't solve the problem
>
> --> changing the file extension of the file to .sage DOES solve the
> problem (great!!! thanks Marshall!)
>
> --> my file was located in a Windows partition (\media\disk
> \blabla...). I tried a "Hello World" program (with .py extension) from
> there and it didn't work either. I copied the file over to my linux
> partition and still didn't work... but if I write it from scratch
> while in linux, then it worked, so IMHO it can in fact be related to
> how windows and linux editors treat \n and \r differently
>
> --> the funny thing is that attach has no problem whatsoever when
> invoked from the sage command line ... it was only when invoked inside
> a notebook that I ran into trouble
>
> thanks again and best wishes,
>
> Ricardo
>
> On Feb 7, 10:20 pm, adrian <[email protected]> wrote:
>
> > I am sorry, I read it wrong; you are indeed giving the full path.
> > Something I was thinking is that it could be related to what happens,
> > in addition to what others have commented is:
>
> > 1) The error is "Syntax error" not "File not found", so maybe the
> > quotes arround the path would work.
>
> > 2) The file is in /media/...   Does it work with other files in other
> > directories?  With .sage files?
>
> > 3)  Can you attach a file in ~/.sage?
>
> > Well, I hope this is fixed.   Or just changing the extension, as
> > Marshal suggested, should work.  This would explain the Syntax Error.
>
> > -Adrian.
>
> > On Feb 7, 6:37 am, ricardomayerb <[email protected]> wrote:
>
> > > Thank you, Adrian.
>
> > > But I think I gave the full path when I used the command:
>
> > > attach /media/disk/thesiswork/thesis2009/sage/src/sympy_files/
> > > thesis_sympy_2009.py
>
> > > but it did not worked in notebook mode (but happens to work perfectly
> > > in command-line mode, I just tried it)
>
> > > Maybe the way to go, for now, is your suggestion of invoking sage with
> > > this -notebook directory option
>
> > > Best,
> > > R
>
> > > On Feb 6, 3:52 pm, adrian <[email protected]> wrote:
>
> > > > 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 
> > > > inhttp://groups.google.com/group/sage-support/browse_thread/thread/3779...
>
> > > > This kind of behaviour is the reason for the ticket 
> > > > inhttp://trac.sagemath.org/sage_trac/ticket/5169
>
> > > > Hope this helps
>
> > > > -Adrian.
>
> > > > On Feb 6, 10:40 am, ricardomayerb <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to