Python, Browsers, and Ubuntu
Shamit

Shamit @shamit_r

About: Fullstack developer, experienced in Testing and Validation. I like to dabble in Data Analysis time to time too. Based in Vancouver, BC. Shoot me a message on LinkedIn, let's connect!

Location:
Vancouver, BC.
Joined:
Mar 3, 2025

Python, Browsers, and Ubuntu

Publish Date: Apr 24
0 0

During my role at Summa Linguae Technologies, I was working on a Python tool that tracked test statuses and included a feature to open a webpage in the browser automatically. The issue was that this functionality worked fine on some systems but wasn’t working on Ubuntu.

To debug, I systematically went through possible causes:
Checked if the browser was installed—ensured that a default browser was set.
Verified user permissions—confirmed that the script had the necessary permissions to launch applications.
Tested different commands separately—ran xdg-open, gio open, and sensible-browser manually to see which worked.

After testing, I found that the usual Python method (webbrowser.open()) wasn’t reliable on Ubuntu because it didn’t always respect the default browser settings. Instead, using xdg-open directly resolved the issue. I updated the script to detect the OS and use the appropriate command dynamically.

Comments 0 total

    Add comment