Hello,

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)

sage: load "test space.py"
Works

sage: load testarg.py arg1
File 'testarg.py arg1' not found ...

attach has the same behaviour, except in the documentation it claims
there is a function attached_files(), which also gives an error.

sage: attached_files()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call
last)

/home/rado/.sage/test.py in <module>()

NameError: name 'attached_files' is not defined


============
In sage notebook:

>>>load test
Works (note that this didn't work in the prompt)

>>>load test.py
Works

>>>load test.py test.py
Works
Works (note in prompt this command doesn't behave the same)

>>>load testarg.py arg1
Error loading /home/rado/.sage/arg1 -- file not found

>>>load test space.py
runs test
Error loading /home/rado/.sage/space.py -- file not found

>>>load "test space.py"
runs test
Error loading /home/rado/.sage/space.py -- file not found

>>>attach test.py
>>>attached_files()
NameError: name 'attached_files' is not defined

------

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).

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

Rado
--~--~---------~--~----~------------~-------~--~----~
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