Su invoking register-python-argcomplete

I’m on AL 8.9

I installed some Python stuff - usual hrs of head scratching with versions x,y,z, instructions that don’t work etc.

Anyway, there’ve been some side effects and I have no idea where/how they arose. So now when I “su” I get errors …

[bth@sws ~]$ su
Password:
Traceback (most recent call last):
File “/home/bth/.local/bin/register-python-argcomplete”, line 68, in
argcomplete.shellcode(
AttributeError: module ‘argcomplete’ has no attribute ‘shellcode’
[root@sws bth]#

…which seem to be connected to su switching environment…

[bth@sws ~]$ su -p # Preserve the entire environment
Password:
[root@sws ~]#

but I can’t find where/what su is reading/accessing to cause it to invoke register-python-argcomplete.

Anyone any ideas on what’s going on / why it’s happpening / what needs to be changed to stop su invoking register-python-argcomplete ?

I’m guessing you now have something in root’s .bashrc or maybe /etc/profile.d that calls register-python-argcomplete but with a partial environment it can’t run the python versions you have installed into your local user environment.

Yeah, nothing obvious there. Suspicions about /etc/profile.d/bash_completion.sh and associated /usr/share/bash-completion/completions files and whatever they call etc etc…
But then again which side is it broken on ? (root / user) …

tbh unless I can see a full call stack up to where its called it’s not worth getting into - I’ll prob bin the VM eventually and restart but this time first sit down and try to come up with some sane way of using python virtual environments so everything stays separate and none of it contaminates the system.

( I ****ing hate python )