Repository navigation
[Bug] enable_broker_on_wsl prints pring to stdout #854
Description
Activity
This is a known issue of the underlying PyMsalRuntime package. Assigning to fengga and CC Ashok Kumar Ramakrishnan (@ashok672) , Iulian C. (@iulico-1)
Also tracked internally at https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3387107
Reacted by Martin GalpinAcked. This is issue is addressed previously. Currently waiting for the next pymsalruntime release so that customer can adopt a new version which contains the fix.
Reacted by Ray LuoHi Martin Galpin (@galpin) , the fix is in pymsalruntime 0.20.0 (released 10/13/2025), could you please upgrade to this version and see if this is fixed? Thanks.
- linked a pull request that will close this issueUpdate pymsalruntime version range to handle the latest 0.20.0 release #858
on Oct 15, 2025 Hi @galpin , the fix is in pymsalruntime 0.20.0 (released 10/13/2025), could you please upgrade to this version and see if this is fixed? Thanks.
Note that the PyMsalRuntime 0.20.0 was released after the latest MSAL Python 1.34.0, so, a
pip install msaldoes NOT currently pick up PyMsalRuntime 0.20.0 by default, until we ship the next version of MSAL in the future. Meanwhile, Martin Galpin (@galpin) you can manually do apip install pymsalruntime==0.20.0in your environment and see how that goes.Sorry for the slow response.
Unfortunately v0.20.0 results in a new error compared to 0.18.1, see below. Running in Ubuntu 22.04.5 LTS via WSL.
Let me know if you need anything else.
v0.18.1
> uv run -p 3.12 --with msal==1.34.0 --with pymsalruntime==0.18.1 repro.py Using CPython 3.12.7 Removed virtual environment at: .venv Creating virtual environment at: .venv Installed 20 packages in 32ms "{{\"ping\",\"success\"}}}"
v0.20.0
> uv run -p 3.12 --with msal==1.34.0 --with pymsalruntime==0.20.0 repro.py Installed 11 packages in 15ms Traceback (most recent call last): File "/home/galpin/r/rbauth/repro.py", line 7, in <module> app = PublicClientApplication( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/galpin/.cache/uv/archive-v0/humv0xhXhsbo5KXE5fkxs/lib/python3.12/site-packages/msal/application.py", line 2046, in __init__ super(PublicClientApplication, self).__init__( File "/home/galpin/.cache/uv/archive-v0/humv0xhXhsbo5KXE5fkxs/lib/python3.12/site-packages/msal/application.py", line 669, in __init__ self._decide_broker(allow_broker, enable_pii_log) File "/home/galpin/.cache/uv/archive-v0/humv0xhXhsbo5KXE5fkxs/lib/python3.12/site-packages/msal/application.py", line 712, in _decide_broker _init_broker(enable_pii_log) File "/home/galpin/.cache/uv/archive-v0/humv0xhXhsbo5KXE5fkxs/lib/python3.12/site-packages/msal/application.py", line 31, in _init_broker from . import broker # Trigger Broker's initialization, lazily ^^^^^^^^^^^^^^^^^^^^ File "/home/galpin/.cache/uv/archive-v0/humv0xhXhsbo5KXE5fkxs/lib/python3.12/site-packages/msal/broker.py", line 14, in <module> import pymsalruntime # Its API description is available in site-packages/pymsalruntime/PyMsalRuntime.pyi ^^^^^^^^^^^^^^^^^^^^ File "/home/galpin/.cache/uv/archive-v0/humv0xhXhsbo5KXE5fkxs/lib/python3.12/site-packages/pymsalruntime/__init__.py", line 11, in <module> ctypes.CDLL(library_path) File "/home/galpin/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu/lib/python3.12/ctypes/__init__.py", line 379, in __init__ self._handle = _dlopen(self._name, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: libwebkit2gtk-4.1.so.0: cannot open shared object file: No such file or directory >
Reacted by Aaron HalfakerMartin Galpin (@galpin) , thanks for the report, but please create a new github issue for it to be properly tracked. CC: xinyuxu1026
Martin Galpin (@galpin) , pymsalruntime v0.20.0 does not come with libwebkitgtk bundled, the user needs to manually install it. Here is the documentation: https://learn.microsoft.com/en-us/entra/msal/python/advanced/linux-broker-py?tabs=ubuntudep#linux-dependencies
xinyuxu1026 Thanks - installing the package resolves the error. If the change of behaviour is expected (e.g. 0.18.1 did not require libwebkitgtk) then I'm happy to ignore.
Reacted by xinyuxu1026Martin Galpin (@galpin) , sounds great! This is expected
Reacted by Martin Galpinpymsalruntime v0.20.0 does not come with libwebkitgtk bundled, the user needs to manually install it. Here is the documentation: https://learn.microsoft.com/en-us/entra/msal/python/advanced/linux-broker-py?tabs=ubuntudep#linux-dependencies
xinyuxu1026 , that doc might not be very discoverable. Could we at least add a
try ... except ...in that code path and then emit an actionable message on the spot, such as "Extra dependency missing, please followhttps://learn.microsoft.com/en-us/entra/msal/python/advanced/linux-broker-py?tabs=ubuntudep#linux-dependencies".Also, let's ping Jiashuo Li (@jiasli) from the Azure CLI team on this topic. The missing-dependency may bring complications on Azure CLI's packaging steps in the future. Is it the right price to pay for a smaller installation package? Jiashuo Li (@jiasli) , please also lete HangLei know this.
Describe the bug
Using the
PublicClientApplication.enable_broker_on_wslargument, the line"{{\"ping\",\"success\"}}}is written to stdout.To Reproduce
Expected behavior
Nothing should be output to stdout.
What you see instead
The MSAL Python version you are using
1.33.0