On Sunday, April 15, 2018 at 7:11:06 AM UTC-7, 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:
>
> 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
>
>
You can trigger the error by a straight call
sage.misc.cython.cython(<cython file>)
The traceback (there is only one frame):
...
669 except Exception as msg: 670 msg = str(msg) + "\n" +
distutils_messages--> 671 raise RuntimeError(msg.strip()) 672
673 if verbose >= 0:
RuntimeError: fileno
I suspect it's this commit:
https://git.sagemath.org/sage.git/commit/?h=c59f37ad5ee719b23293a0f677422f5f818b7981
where this code was committed:
try:
# Capture errors from distutils and its child processes
with open(os.path.join(target_dir, name + ".err"), 'w+') as errfile:
try:
with redirection(sys.stderr, errfile, close=False):
dist.run_command("build")
finally:
errfile.seek(0)
distutils_messages = errfile.read()
except Exception as msg:
msg = str(msg) + "\n" + distutils_messages
raise RuntimeError(msg.strip())
This works on the command line:
sage: F=open("er",'w+')
sage: sage.misc.sage_ostools.redirection(sys.stderr,F)
but in jupyter we get an error:
UnsupportedOperation: fileno
because sys.stderr is now:
<ipykernel.iostream.OutStream object at 0x7ff909f6ed10>
It looks like sage_ostools.redirection might need some love.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.