Re: [sage-support] Cython in jupyter notebook

2018-04-16 Thread Jeroen Demeyer

On 2018-04-15 16:08, Simon King wrote:

Hi!

The following cython code compiles fine in SageMath command line version
and it *used* to compile fine in the jupyter notebook one year ago:


Fix at https://trac.sagemath.org/ticket/25177

--
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 https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Cython in jupyter notebook

2018-04-15 Thread Simon King
Hi!

The following cython code compiles fine in SageMath command line version
and it *used* to compile fine in the jupyter notebook one year ago:

 cython("""
 def mantisse():
 cdef double a = 1
 cdef double b = 2
 cdef int i = 0
 while True:
 a += b**(-i)
 print("%2d: %.53f"%(i,a))
 if a==1:
 return i-1
 i += 1
 a = 1
 """)

However, in the jupyter notebook I no get the error

RuntimeError  Traceback (most recent call last)
 in ()
 12 i += 1
 13 a = 1
---> 14 """)

/home/king/Sage/git/sage/local/lib/python2.7/site-packages/sage/misc/lazy_import.pyx
 in sage.misc.lazy_import.LazyImport.__call__ 
(build/cythonized/sage/misc/lazy_import.c:3756)()
352 True
353 """
--> 354 return self.get_object()(*args, **kwds)
355 
356 def __repr__(self):

/home/king/Sage/git/sage/local/lib/python2.7/site-packages/sage/misc/cython.pyc 
in cython_compile(code, **kwds)
   1005 with open(tmpfile,'w') as f:
   1006 f.write(code)
-> 1007 return cython_import_all(tmpfile, get_globals(), **kwds)

/home/king/Sage/git/sage/local/lib/python2.7/site-packages/sage/misc/cython.pyc 
in cython_import_all(filename, globals, **kwds)
895   code
896 """
--> 897 m = cython_import(filename, **kwds)
898 for k, x in iteritems(m.__dict__):
899 if k[0] != '_':

/home/king/Sage/git/sage/local/lib/python2.7/site-packages/sage/misc/cython.pyc 
in cython_import(filename, **kwds)
870 - the module that contains the compiled Cython code.
871 """
--> 872 name, build_dir = cython(filename, **kwds)
873 
874 oldpath = sys.path

/home/king/Sage/git/sage/local/lib/python2.7/site-packages/sage/misc/cython.pyc 
in cython(filename, verbose, compile_message, use_cache, create_local_c_file, 
annotate, sage_namespace, create_local_so_file)
669 except Exception as msg:
670 msg = str(msg) + "\n" + distutils_messages
--> 671 raise RuntimeError(msg.strip())
672 
673 if verbose >= 0:

RuntimeError: fileno

What goes wrong?

I'd like to have it solved till the day after tomorrow, as the notebook
is to be used in some exercise group.

Best regards,
Simon

-- 
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 https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.