Issue
Some print() outputs are being dropped in my notebook, but I can't see any particular pattern or reason:
s = 'https://ad.doubleclick.net/'
t = 'ttps://ad.doubleclick.net/'
u = 'https://ad.doubleclick.net'
v = 'https://ad.doublclick.net/'
w = 'https://pubads.g.doubleclick.net/gampad/ads?caps'
for string in [s, t, u, v]:
print('str:', string)
print('repr(str):', repr(string))
print()
Outputs:
str:
repr(str): 'https://ad.doubleclick.net/'
str: ttps://ad.doubleclick.net/
repr(str): 'ttps://ad.doubleclick.net/'
str: https://ad.doubleclick.net
repr(str): 'https://ad.doubleclick.net'
str: https://ad.doublclick.net/
repr(str): 'https://ad.doublclick.net/'
str:
repr(str): 'https://pubads.g.doubleclick.net/gampad/ads?caps'
What happened to my first and last str:
lines??
Only happens in notebooks, running python interpreter in the terminal does not have this issue.
Python 3.8.5
> which jupyter
/Library/Frameworks/Python.framework/Versions/3.8/bin/jupyter
> jupyter --version
Selected Jupyter core packages...
IPython : 8.0.0
ipykernel : 6.7.0
ipywidgets : 7.7.1
jupyter_client : 7.1.1
jupyter_core : 4.9.1
jupyter_server : not installed
jupyterlab : not installed
nbclient : 0.5.10
nbconvert : 6.4.0
nbformat : 5.1.3
notebook : 6.4.7
qtconsole : not installed
traitlets : 5.1.1
Solution
Not exactly an answer, but this is a result of Jupyter notebook checking if string variables are URLs and if so, making them into clickable links in the output area. The output of your cell is rendered inside a <pre>
tag and looks like this:
<pre>
str: <a target="_blank" href="https://ad.doubleclick.net/">https://ad.doubleclick.net/</a>
repr(str): 'https://ad.doubleclick.net/'
str: ttps://ad.doubleclick.net/
repr(str): 'ttps://ad.doubleclick.net/'
str: <a target="_blank" href="https://ad.doubleclick.net">https://ad.doubleclick.net</a>
repr(str): 'https://ad.doubleclick.net'
str: <a target="_blank" href="https://ad.doublclick.net/">https://ad.doublclick.net/</a>
repr(str): 'https://ad.doublclick.net/'
str: <a target="_blank" href="https://pubads.g.doubleclick.net/gampad/ads?caps">https://pubads.g.doubleclick.net/gampad/ads?caps</a>
repr(str): 'https://pubads.g.doubleclick.net/gampad/ads?caps'
</pre>
Now the fact that some of the links don't appear is not a Jupyter notebook issue, you can try render this HTML on a site like https://html.onlineviewer.net and see the same issue. But for me this issue occurs only in Firefox, not in two other browsers I checked (Safari and Chrome). Since I couldn't find any discussion of this behaviour, I opened up a ticket on Bugzilla here.
Answered By - Josh Friedlander
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.