Sample Header Ad - 728x90

Bash File Completion Creates Python Virtual Environment

1 vote
0 answers
149 views
Sometimes when I use tab file completion in a bash shell it pauses for one or two seconds before showing tab completion, and creates a Python virtual environment in my current directory. For example if I was running a command in a directory containing a single file named example.pdf and wanted tab completion to finish the command:
$ ls
example.pdf
$ pdf2txt example
$ pdf2txt example.pdf
This file has text.
$ ls
bin example.pdf lib lib64 include pyvenv.cfg
The result is that I either have to remove all these files, or accept that my directories will be littered with mystery python virtual environments. In my home directory, the python venv resulting from bash tab completion just uses ~/bin so I have random python scripts commingled with my bash scripts. Unfortunately, I have been unable to reliably recreate this problem, but my sense is that it occurs when more complex files are present (pdfs, docx, etc.). Because of the nature of the problem I have been unable to trouble shoot through web searches because all results are about implementing tab completion while writing Python scripts. System information:
OS:     Fedora 36 (though problem started around F34)
Kernel: 5.17.13-300.fc36.x86_64
A limited recursive list of python files (I'm assuming the venv files are identical each time):
$ find . -maxdepth 2
./bin
./bin/python3
./bin/python
./bin/python3.10
./bin/pip
./bin/pip3
./bin/pip3.10
./bin/Activate.ps1
./bin/activate
./bin/activate.csh
./bin/activate.fish
./include
./lib
./lib/python3.10
./pyvenv.cfg
Full file inventories: tree is here ls -R is here Files related to bash_completion: /etc/profile.d/bash_completion looks fairly normal ~/.config/bash_completion doesn't exist /usr/share/bash-completion/bash_completion was rejected by pastebin but header says that latest version is on github
Asked by kuirolo (11 rep)
Jun 27, 2022, 08:04 PM