WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: blueman.tcz needs specific python3 version  (Read 155 times)

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1790
blueman.tcz needs specific python3 version
« on: February 13, 2026, 12:44:33 PM »
I'm running blueman.tcz in TCL17 x86_64.

blueman.tcz depends on py3.9gobject.tcz. If /usr/local/bin/python3 is a symlink to python3.14 (or any python3 version other than 3.9) then blueman doesn't work because the modules it needs are located in /usr/local/lib/python3.9/site-packages/blueman:

Code: [Select]
$ blueman-applet &
eileen@blaptop:~$ Traceback (most recent call last):
  File "/usr/local/bin/blueman-applet", line 15, in <module>
    from blueman.Functions import create_logger, create_parser, set_proc_title
ModuleNotFoundError: No module named 'blueman'

$ tce-status -i | grep python
python3.14
python3.9
python3.9-olefile
python3.9-pillow

$ sudo ln -sf /usr/local/bin/python3.9 /usr/local/bin/python3

$ blueman-applet &
-> now it works

I've encountered this problem of /usr/local/bin/python3 not pointing to the expected python3 version several times before: Sometimes when using extensions, sometimes when building extensions.

I thought about different ways to prevent this kind of problem. One idea is to use a startup script (/usr/local/tce.installed/blueman in this case) that forces /usr/local/bin/python3 to point to the expected python3 version. This approach is risky because it would break applications that need a different python3 version.

Maybe the best solution would be for those python3 applications that depend on a specific python3 version to have a more specific shebang? So in blueman.tcz, for example, the python scripts would have  #!/usr/local/bin/python3.9  shebang rather than  #!/usr/local/bin/python3? That's the best solution I can think of at the moment.

« Last Edit: February 13, 2026, 12:47:17 PM by GNUser »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 15478
Re: blueman.tcz needs specific python3 version
« Reply #1 on: February 13, 2026, 02:28:41 PM »
I’ve been wondering for a while how to deal with this :-\

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1790
Re: blueman.tcz needs specific python3 version
« Reply #2 on: February 13, 2026, 02:35:11 PM »
What do you think of the idea of using a more specific shebang? In the specific case of blueman.tcz, I'm suggesting replacing all occurrences of #!/usr/local/bin/python3 with #!/usr/local/bin/python3.9

EDIT: Let me test this idea and see if it works (to make sure there is no unexpected breakage if I leave /usr/local/bin/python3 pointing to /usr/local/bin/python3.14)
« Last Edit: February 13, 2026, 02:37:16 PM by GNUser »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 15478
Re: blueman.tcz needs specific python3 version
« Reply #3 on: February 13, 2026, 02:36:39 PM »
That’s not a bad idea - I’ll have a look in the next couple of days.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1790
Re: blueman.tcz needs specific python3 version
« Reply #4 on: February 13, 2026, 02:48:44 PM »
Hi Juanito. I tried my shebang idea and it works! I modified the blueman.tcz extension like this:

Code: [Select]
$ sed -i 's|#!/usr/local/bin/python3|#!/usr/local/bin/python3.9|' ./squasfs-root/usr/local/bin/*
Then I loaded the modified blueman.tcz.

Lo and behold, the extension works as expected even though /usr/local/bin/python3 is a symlink to /usr/local/bin/python3.14 :)
« Last Edit: February 13, 2026, 02:51:02 PM by GNUser »

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1500
Re: blueman.tcz needs specific python3 version
« Reply #5 on: February 13, 2026, 04:22:29 PM »
speaking of shebang's   Is it more proper to do?

/usr/bin/env python3.9


Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1790
Re: blueman.tcz needs specific python3 version
« Reply #6 on: February 13, 2026, 04:52:22 PM »
That's a good point. Yes, using  env  would be more "proper" and portable.

But since we are specifically talking about packaging for the TCL repo (rather than posting the application to some distro-agnostic location), I think  #!/usr/bin/env python3.9  and  #!/usr/local/bin/python3.9  are more or less equally good.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 15478
Re: blueman.tcz needs specific python3 version
« Reply #7 on: Today at 03:59:36 AM »
Lo and behold, the extension works as expected even though /usr/local/bin/python3 is a symlink to /usr/local/bin/python3.14 :)

Please go ahead and submit  :)

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1790
Re: blueman.tcz needs specific python3 version
« Reply #8 on: Today at 09:19:07 AM »
Please go ahead and submit  :)
Done :)

If/when I encounter this same problem in other extensions in the future, I'll make the same adjustment and submit it.