[sage-support] Why can't I see my code while debugging with trace?

2013-11-06 Thread Tobias Weich
Hi,
If I load some sage script and try to debug it with trace I am unable to 
see the code which I'm debugging

load('~/test.sage')
trace('example_func()')

yields only to an output like:

ipdb s
--Call--
 string(2)example_func()

ipdb s
 string(3)example_func()


which is not very helpful. If I however attach the file everything works 
fine. As I want to use my scripts in the notebook and only debug on the 
command line I have the impression that I need load in my scripts. Is 
there a possibility to debug in loaded files? 

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


test.sage
Description: Binary data


[sage-support] Re: Why can't I see my code while debugging with trace?

2013-11-06 Thread Nils Bruin
On Wednesday, November 6, 2013 1:56:12 AM UTC-8, Tobias Weich wrote:

 Hi,
 If I load some sage script and try to debug it with trace I am unable to 
 see the code which I'm debugging

 load('~/test.sage')
 trace('example_func()')

 yields only to an output like:

 ipdb s
 --Call--
  string(2)example_func()

 ipdb s
  string(3)example_func()


 which is not very helpful. If I however attach the file everything works 
 fine. As I want to use my scripts in the notebook and only debug on the 
 command line I have the impression that I need load in my scripts. Is 
 there a possibility to debug in loaded files? 


When python interprets code it compiles it into an internal format, 
together with some information on where to find the source (i.e., the file 
the code was obtained from). When you enter code interactively there isn't 
a file that can be referred to, so it's registered as coming from 
string. You don't get source from there.

Sage code isn't python, so there is a translation step involved in loading 
`test.sage`. As far as python is concerned, it is getting code from an 
ephemeral source, just as when code is entered interactively. So the source 
that python used to compile the code isn't accessible any more.

If you do load(sage.misc.preparser.preparse_file_named('test.sage')) an 
intermediate file gets produced explicitly, so python known where to look 
for the source (which will be a little processed compared to what is in 
your sage file. You may have to clean up the temporary file yourself 
afterwards.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Can't login to notebook

2013-11-06 Thread James Traynor

I have already sled this on Ask a Question and tried the following:

Nothing seems to work.




from sagenb.notebook.notebook import load_notebook
nb = load_notebook(directory_to_run_sage_in)
user_manager = nb.user_manager()
user_manager.set_accounts(True)
user_manager.add_user(username, password, email@place, user)
nb.save()

linkhttp://ask.sagemath.org/question/3176/cant-change-user-name?answer=4275#4275

posted *yesterday*
[image: Shashank gravatar image]http://ask.sagemath.org/users/92/shashank/
Shashank http://ask.sagemath.org/users/92/shashank/ [image: flag of 
United States] 
1655 ● 7 ● 28 ● 60 

Thank you, but it's all Greek to me. I think I did have a user name for the 
notebook but can't think of it. Both it and the password were 'saved' and 
in the past I just hit the button.
Jim http://ask.sagemath.org/users/2143/jim/ (yesterday)

If you want to know your username just open the terminal and type cd 
~/.sage/sage_notebook.sagenb/home and type ls. You will see the usernames 
of all the users. But if you have reset the notebook you should be able to 
log in with admin as the username.
Shashank http://ask.sagemath.org/users/92/shashank/ (yesterday)

Followed instructions on first command(3x) to get user name - got error 
messages. Reset password again. Put 'admin' as user name - notebook 
response 'wrong password'
Jim http://ask.sagemath.org/users/2143/jim/ (yesterday)edit
post a comment

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Error attaching file in notebook 5.12

2013-11-06 Thread stevemit
When I attach a simple .sage file in a notebook I get name 'Integer' is not 
defined.

The notebook expression is:

attach('/path/to/agcd.sage')

The file contains:

x=1

This works from the Sage command line.  It fails in notebook each time I 
evaluate the expression.

Sage version:

'Sage Version 5.12, Release Date: 2013-10-07'

OS:  Ubuntu 12.04 LTS 64-bit under VMWare 9
Installed from Ubuntu 64-bit binary distribution.

Traceback (most recent call last):
  File stdin, line 1, in module
  File _sage_input_3.py, line 10, in module
exec compile(u'open(___code___.py,w).write(# -*- coding: utf-8 -*-\\n 
+ 
_support_.preparse_worksheet_cell(base64.b64decode(YXR0YWNoKCcvaG9tZS9zdGV2ZS9Eb2N1bWVudHMvUENUX3ByaW1lL2FnY2Quc2FnZScp),globals())+\\n);
 execfile(os.path.abspath(___code___.py))
  File , line 1, in module

  File /tmp/tmpVI0sMx/___code___.py, line 2, in module
exec compile(uattach('/home/steve/Documents/PCT_prime/agcd.sage') + '\n', 
'', 'single')
  File , line 1, in module

  File lazy_import.pyx, line 344, in 
sage.misc.lazy_import.LazyImport.__call__ (sage/misc/lazy_import.c:2550)
  File 
/opt/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/misc/attached_files.py,
 line 344, in attach
load(filename, globals(), attach=True)
  File 
/opt/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/misc/preparser.py,
 line 1768, in load
execfile(preparse_file_named(fpath), globals)
  File /home/steve/.sage/temp/ubuntu/14825/agcd.sage6EZlGm.py, line 5, in 
module
_sage_const_1 = Integer(1)
NameError: name 'Integer' is not defined

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: Error attaching file in notebook 5.12

2013-11-06 Thread kcrisman


On Wednesday, November 6, 2013 2:21:27 PM UTC-5, stevemit wrote:

 When I attach a simple .sage file in a notebook I get name 'Integer' is 
 not defined.


I think this is known.  See for instance 
https://github.com/sagemath/sagenb/issues/169 - I feel like there was a 
Trac ticket as well, but I'm not sure.

Does anyone know exactly when this broke?  The issue above has some ideas...

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Running doctests in group writable directory

2013-11-06 Thread scmancuso
After our sysadmin updated the computer we use for a major project in Sage from 
v5.3 to v5.12, our automated doctests stopped working. It appears to be because 
the directory that contains our code is group writable (which makes sense 
because there are multiple users in our group who need to use this directory). 
The directory is not world writable. Is there a way to allow the doctests to 
run in a group writable directory?

Here is the output when trying to run a doctest via sage -t FILENAME:

Traceback (most recent call last):
  File 
/Applications/Sage-5.12-OSX-64bit-10.6.app/Contents/Resources/sage/local/bin/sage-runtests,
 line 87, in module
err = DC.run()
  File 
/Applications/Sage-5.12-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/doctest/control.py,
 line 882, in run
self.test_safe_directory()
  File 
/Applications/Sage-5.12-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/doctest/control.py,
 line 391, in test_safe_directory
.format(os.getcwd()))
RuntimeError: refusing to run doctests from the current directory 
'/CURRENT/DIRECTORY' since untrusted users could put files in this directory, 
making it unsafe to run Sage code from

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: Running doctests in group writable directory

2013-11-06 Thread Volker Braun
See http://trac.sagemath.org/ticket/13579#comment:40 and following...


On Wednesday, November 6, 2013 4:14:08 PM UTC-8, scma...@gmail.com wrote:

 After our sysadmin updated the computer we use for a major project in Sage 
 from v5.3 to v5.12, our automated doctests stopped working. It appears to 
 be because the directory that contains our code is group writable (which 
 makes sense because there are multiple users in our group who need to use 
 this directory). The directory is not world writable. Is there a way to 
 allow the doctests to run in a group writable directory?

 Here is the output when trying to run a doctest via sage -t FILENAME:

 Traceback (most recent call last):
   File 
 /Applications/Sage-5.12-OSX-64bit-10.6.app/Contents/Resources/sage/local/bin/sage-runtests,
  
 line 87, in module
 err = DC.run()
   File 
 /Applications/Sage-5.12-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/doctest/control.py,
  
 line 882, in run
 self.test_safe_directory()
   File 
 /Applications/Sage-5.12-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/doctest/control.py,
  
 line 391, in test_safe_directory
 .format(os.getcwd()))
 RuntimeError: refusing to run doctests from the current directory 
 '/CURRENT/DIRECTORY' since untrusted users could put files in this 
 directory, making it unsafe to run Sage code from



-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: Error attaching file in notebook 5.12

2013-11-06 Thread Volker Braun
Attach might have never worked in the notebook; there were no doctests for 
it.


On Wednesday, November 6, 2013 1:14:05 PM UTC-8, kcrisman wrote:



 On Wednesday, November 6, 2013 2:21:27 PM UTC-5, stevemit wrote:

 When I attach a simple .sage file in a notebook I get name 'Integer' is 
 not defined.


 I think this is known.  See for instance 
 https://github.com/sagemath/sagenb/issues/169 - I feel like there was a 
 Trac ticket as well, but I'm not sure.

 Does anyone know exactly when this broke?  The issue above has some 
 ideas...


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Pb with shared notebooks

2013-11-06 Thread Laurent Decreusefond
Hi,
I’ve Mavericks installed on my Mac. The compiled version of Sage 5.12 works 
perfectly (but I can’t compile it, it fails on polybori package). However, my 
main problem is not that one. 

I’m used to have my notebooks shared on a CloudMe folder.

Precisely I’ve two Mac with both Mavericks and sage-5.12 installed. My .profile 
contains the line

export DOT_SAGENB=~/Documents/CloudMe/sage-notebooks

On the laptop A (the first to create the notebooks), it works like a charm. But 
when I try to access the same notebooks on laptop B, I’ve the following error 
message too cryptic for me.

Any help?


basilic:sage Laurent$ ./sage
┌┐
│ Sage Version 5.12, Release Date: 2013-10-07│
│ Type notebook() for the browser-based notebook interface.│
│ Type help() for help.│
└┘
sage: notebook()
---
OSError   Traceback (most recent call last)
ipython-input-1-3728cb3d7c7d in module()
 1 notebook()

/Applications/sage/devel/sagenb/sagenb/notebook/notebook_object.pyc in 
__call__(self, *args, **kwds)
226 
227 def __call__(self, *args, **kwds):
-- 228 return self.notebook(*args, **kwds)
229 
230 notebook = run_notebook.notebook_run

/Applications/sage/devel/sagenb/sagenb/notebook/run_notebook.pyc in 
notebook_run(self, directory, port, interface, port_tries, secure, reset, 
accounts, openid, server_pool, ulimit, timeout, doc_timeout, upload, 
automatic_login, start_path, fork, quiet, server, profile, subnets, 
require_login, open_viewer, address)
527 # if none use defaults
528 
-- 529 nb = notebook.load_notebook(directory)
530 
531 directory = nb._dir

/Applications/sage/devel/sagenb/sagenb/notebook/notebook.pyc in 
load_notebook(dir, interface, port, secure, user_manager)
   1809 
   1810 dir = make_path_relative(dir)
- 1811 nb = Notebook(dir)
   1812 nb.interface = interface
   1813 nb.port = port

/Applications/sage/devel/sagenb/sagenb/notebook/notebook.pyc in __init__(self, 
dir, user_manager)
157 
158 # Store / Refresh public worksheets
-- 159 for id_number in 
os.listdir(self.__storage._abspath(self.__storage._user_path(pub))):
160 if id_number.isdigit():
161 a = pub/+str(id_number)

/Applications/sage/devel/sagenb/sagenb/storage/filesystem_storage.pyc in 
_user_path(self, username)
117 
118 #Move the directory to the __store__ directory
-- 119 os.rename(path, new_path)
120 
121 #new_path now points to the actual directory

OSError: [Errno 66] Directory not empty

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.