On Apr 24, 6:24 pm, Rado <rki...@gmail.com> wrote:
> Hello,

Hi Rado,

> I was trying to load some python files and found some weird behaviour
> of the load/attach commands. I have three test files
>
> (a normal file) /home/rado/.sage/test.py
> (a file with space in the name) /home/rado/.sage/test space.py
> (a file to take arguments from command line) /home/rado/.sage/
> testarg.py
>
> In sage prompt:
> sage: cd /home/rado/.sage
> sage: load test
> File 'test' not found ...
>
> sage: load test.py
> Works
>
> sage: load test space.py
> Works (and probably shouldn't so it can enforce quotation marks)

No, this was explicitly fixed since it was requested by users. I think
if you add spaces to file names you have it coming, but I think it was
worth fixing it.

> sage: load "test space.py"
> Works
>
> sage: load testarg.py arg1
> File 'testarg.py arg1' not found ...

Why would that even work? The attach doctstring says:

        USAGE: ``attach file1 file2 ...`` - space-separated
        list of .py, .spyx, and .sage files.


So arg1 is not going to get passed as an argument. The error message
should probably be specific and tell you that arg1 cannot be found.  I
am also not sure of the fix that allowed spaces in filenames does not
break the attach command for multiple files.

<SNIP>

> Hope this shows the inconsistency in the execution of load/attach in
> prompt and in notebook. What also worries me is that both fail at
> passing arguments to the scripted called. I feel that that the ipython
> %run syntax is the best (of course the decision is up to the
> developers).
>
> I found the code for the prompt in ~/sage-3.4/local/lib/python2.5/site-
> packages/sage/misc/interpreter.py and looked over it. I know enough
> python to understand the code there, and I can purpose a patch (once
> its decided how exactly this should work).

The code you want to edit is in $SAGE_ROOT/devel/sage/sage. Once you
have done changes you need to exit Sage, run sage -b and restart Sage
to have the changes go live. (you can also run ./sage -br to build any
changes and then start Sage).

The files in devel/sage are in a mercurial repo, if you need some more
pointers here let us know.

> I don't know where to look for the notebook interpreter code.

I have no clue, but I would expect it to use the same code as the Sage
command line interface.

> Rado

Cheers,

Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to