question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jupyter Notebooks don't support Halo

See original GitHub issue

While Halo works perfectly fine in the terminal, I can’t get Halo to work inside a Jupyter notebook. I am running the following code in the first cell of the notebook:

from halo import Halo
from time import sleep
with Halo(text='Loading', spinner='dots'):
    sleep(5)

The program runs through without any errors, but no spinner is shown at all.

I figured out, that if you write something to stdout with sys.stdout prior to calling Halo, then the spinner is shown, but each spinner and corresponding text are shown next to each other, i.e. clearing the current line doesn’t work.

from halo import Halo
import sys
from time import sleep
sys.stdout.write('test\n')
with Halo(text='Loading', spinner='dots'):
    sleep(5)

returns the output

test
⠋ Loading⠙ Loading⠹ Loading⠸ Loading⠼ Loading⠴ Loading⠦ Loading⠧ Loading⠇ Loading⠏
Loading⠋ Loading⠙ Loading⠹ Loading⠸ Loading⠼ Loading⠴ Loading⠦ Loading⠧ Loading⠇
Loading⠏ Loading⠋ Loading⠙ Loading⠹ Loading⠸ Loading⠼ Loading⠴ Loading⠦ Loading⠧ 
Loading⠇ Loading⠏ Loading⠋ Loading⠙ Loading⠹ Loading⠸ Loading⠼ Loading⠴ Loading⠦ 
Loading⠧ Loading⠇ Loading⠏ Loading⠋ Loading⠙ Loading⠹ Loading⠸ Loading⠼ Loading⠴ 
Loading⠦ Loading⠧ Loading⠇ Loading⠏ Loading⠋ Loading⠙ Loading⠹ Loading⠸ Loading⠼ 
Loading⠴ Loading⠦ Loading⠧ Loading

Is there something wrong on my end, and do you have an idea how to fix that? It would be really nice if Halo worked with Jupyter too. Thanks for your efforts and for sharing this library!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
manrajgrovercommented, May 6, 2018

This is fixed in #40 thanks to @JungWinter! This will be made available soon in next release. I need to do few fixes before making a release.

0reactions
manrajgrovercommented, Jan 3, 2018

@JungWinter Please send a PR for this. I’ll review the code. 😄 Thank you for working on this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Notebooks suck: change my mind : r/Python - Reddit
Many people blame Jupyter for encouraging bad coding habits, but I have another view: there is a lot of hard-to-read code in notebooks...
Read more >
Halo CME on Twitter: "I enjoyed and learned at least something from ...
I still have difficulty of getting started, not even understanding basic things like how to open jupyter notebook, etc. More help needed for...
Read more >
Supplement of EUREC A's HALO - ESSD
This notebook shows how to plot the flight tracks of the HALO aircraft. ... We generally don't support ignoring warnings, however, ...
Read more >
Starter Programing Exercise | Monica Valluri
This programing exercises is designed to help you to become familiar with how to make some basic plots and carry out some simple...
Read more >
fastpages | An easy to use blogging platform with support for ...
An easy to use blogging platform with support for Jupyter Notebooks. ... blog posts via GitHub Actions, so you don't have to fuss...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found