vbraun / exportsagenb Goto Github PK
View Code? Open in Web Editor NEWExport SageNB Notebooks (to Jupyter)
License: GNU General Public License v3.0
Export SageNB Notebooks (to Jupyter)
License: GNU General Public License v3.0
Unfortunately people use all possible strange charssets in worksheet names etc.
I have strange effect where:
sagenb-export --list
works and gives list with i18n chars
but
sagenb-export --list > file fails with
'ascii' codec can't encode character u'\u0142' in position 23: ordinal not in range(128)
btw: LC_ALL are set tu utf8
I have changes in sagenb_reader, open to io.open with utf-8 encoding explicitely, but it gave me:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf3 in position 368: invalid continuation byte
The problematic conf file contained indeen some junk:
VWDI projekt - R�\u017cankowski, Kie\u0142pi\u0144ski, Kozok
I have & inside latex equations which were originally used for eqs. alignment ... & =&...
also some html tags like
were left inside $$ $$
I have actually two issue with testing:
site-packages
folder. We can't have everyone test folder ending there.I want convert many sws files into ipynb files. How to do it with ExportSageNB?
$ LC_CTYPE="C.UTF-8" python2.7 -m unittest discover
......
----------------------------------------------------------------------
Ran 6 tests in 0.020s
OK
$ LC_CTYPE="POSIX" python2.7 -m unittest discover
.E....
======================================================================
ERROR: test_aleksandra_slapik_44 (test.test_sagenb_writer.ReadSageNB)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/infinity0/var/lib/sage/sagenb-export/test/test_sagenb_writer.py", line 39, in test_aleksandra_slapik_44
ipynb.write(self.tmp_filename(u'WDI projekt - R\xf3\u017cankowski, Kie\u0142pi\u0144ski, Kozok.ipynb'))
File "/home/infinity0/var/lib/sage/sagenb-export/sagenb_export/ipynb_writer.py", line 58, in write
write(ipynb, filename)
File "/usr/lib/python2.7/dist-packages/nbformat/__init__.py", line 163, in write
with io.open(fp, 'w', encoding='utf-8') as f:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 41-42: ordinal not in range(128)
----------------------------------------------------------------------
Ran 6 tests in 0.020s
FAILED (errors=1)
1
This is because you pass a unicode string type as a filename. Python will implicitly try to encode this using LC_CTYPE, which doesn't support that particular value. You can fix this in several ways, I'm not sure which way you prefer:
IpynbWriter.write
can only accept byte
filenames, and do the encode('utf-8')
in the test. This is probably the simplest.IpynbWriter.write
can accept unicode string filenames too, and do encode('utf-8')
in there, if it's a string type.filename_encoding
param to IpynbWriter.write
.Files from "data dir attached to sagenb notebooks are not saved.
There is a solution in sws2rst, namely for each name there is a directory created with _files suffix and
internal links are also updated.
%time "magic" in sagenb works in fact as "cell magic" in sagenb.
However is not converted to %%time in ipynb ;-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.