importing a specific libs prevent the output display
See original GitHub issueDescripsion
As you can see on the image provided a normal jupyter-execute
prints work but when I import my lib (sepal_ui), I get this strange display ending by "\n "}}}, "version_major": 2, "version_minor": 0}
.
It seems related to https://github.com/jupyter-widgets/ipywidgets/issues/1305 but I don’t get how it is link to this repository. Did someone already experiment this error and can tell me what’s wrong in my lib ?
screenshot
steps to reproduce
create a new project:
mkdir docs
cd docs
sphinx-quickstart
then update your environment with the sepal_ui
lib:
pip install sepal_ui
update conf.py:
# conf.py
# [...]
extensions = [
'jupyter_sphinx',
]
# [...]
update index.rst:
.. jupyter-execute::
print('hello ')
.. jupyter-execute::
from sepal_ui import sepalwidgets as sw
build it and watch the produced single html page
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
suppress output on library import in python - Stack Overflow
I'd rather not touch the library, as I need to just suppress the output on one particular script and the library is used...
Read more >Python import: Advanced Techniques and Tips
The Python import system is as powerful as it is useful. In this in-depth tutorial, you'll learn how to harness this power to...
Read more >importlib — The implementation of import — Python 3.11.1 ...
A legacy method which when implemented calculates and returns the given module's representation, as a string. The module type's default __repr__() will use...
Read more >Secure loading of libraries to prevent DLL preloading attacks
Provides guidance for software developers that design applications that dynamically load DLLs without specifying a fully qualified path name.
Read more >Importing Existing Libraries to Your Connected Workspace in ...
In the Components panel, choose the Import Library option from the. menu. If a database or file-based library is currently selected in the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would be happy to contribute !
A first and easy fix is the replace
</script>
by</scrip>
because it’s in the end the only one that can cause trouble but i don’t know if it can have any other consequences in the libhttps://stackoverflow.com/questions/22488830/script-within-a-javascript-string-in-a-script-tag
https://stackoverflow.com/questions/1061697/whats-the-easiest-way-to-escape-html-in-python
from what I understand the only one that can interact is
</script>
as everything is included in a<script>
tag. I experimented also with escape and it also work I’m just not sure it’s necessary.For my small usecase it works and everything is displayed as expected on screen.
edit
If the output cell include “<” or “>” I don’t think we want them to be escaped so a dedicated replace seems to be the safest to me.