Removing Explorer pHat banners

I’m running the examples, and with each one I get a banner at the start,
“Explorer pHat Detected…”
and after my code runs, a series that starts with
“Explorer Hat exiting cleanly…”

How do I turn these messages off and only see the print calls I do in my code?

Post your full code and I may be able to tell you what to remove.

It’s really simple, and not much to remove, and the code runs fine. It’s just the start and ending banners.

#!/usr/bin/env python

import time
import explorerhat



I was afraid you’d say that. I went looking at the examples and didn’t see anything obvious as to why you get those banners? I have several Explorer pHats here, haven’t played with one in a long time though. Mine all run headless so I wouldn’t see those massages anyway. I’m using mine to drive motors for some rovers.
I don’t have time to do anything tonight but I will try and dig one out tomorrow and run some examples.
I’m guessing the explorer phat detected is happening with (right after) the import explorerhat.
And the Explorer Hat exiting cleanly right after the exit command.

Have a look at this, not entirely sure if its applicable though?

It’s odd, as with an enviro pHat, I don’t get any “extras” when I run my scripts. (I’m using python-script in nodejs to get the output so I want it simple).

I don’t see anything in the env that might trigger messages like this, and what I installed is the latest libraries as of today.

Here’s exactly what I see output wise:

Explorer pHAT detected…

Explorer HAT exiting cleanly, please wait…
Stopping flashy things…
Stopping user tasks…
Cleaning up…

I’ll play around with a couple of my Pi’s tomorrow and see what messages I get. I don’t have an enviro pHat but I have a Pi with a BMP680, LED shim etc connected. A pirate radio with a pHat Beat too. These all normally run headless but I’ll hook up a monitor before I boot them up. They all boot to command line so if those messages are there I should see them.
The ones you see when doing the exit are likely normally shown by default. I use the shutdown command but switch it to exit if I’m testing code modifications. A quick edit of my python file and I can check those messages. And see what comes up on shut down. I’ll post back what I find tomorrow.

Just FYI my python files are run on boot up via crontab. I shut down my Pi with the
os.system("sudo shutdown now -P")
If I just want to stop my running python file I use
raise SystemExit

I just ran the and I got the Explorer pHAT detected message. Had to quickly grab my rover as it started to try and drive off of my table, lol.
I’m sure I’d get the other prompts too if I did an exit. That must be written into the library?
@gadgetoid Phil or @sandyjmacdonald Sandy may know how to suppress them? I don’t.

1 Like

These messages were a poor design choice on my part- aiming to reassure beginners that everything was working correctly.

They were removed a while back, however, so you shouldn’t be seeing them. What do you see if you pip freeze | grep explorerhat?

no output at all, but at this point the phat isn’t attached to the pi.

Oh, pip3 freeze | grep explorerhat?

In either case you might want to make sure you have the most up-to-date version for the Python version you’re running:

sudo pip install -U explorerhat


sudo pip3 install -U explorerhat

I ran both update commands. Nothing changed with them. I still get the extra messages. Could it be because i have the phat and not the hat?