I can use Popen with a bash script to invoke a non-interactive login shell by using '-l' in the shebang line (#!), e.g.
import subprocess
out, err = subprocess.Popen(['shellscript.sh', 'arg'], env={}).communicate()
with contents of shell script something like
#!/bin/bash -l
command --option $1
However, I'm wondering if it's possible to invoke a non-interactive login shell in a Python subprocess without using an intermediate shell script, e.g.
import subprocess
out, err = subprocess.Popen(['command', '--option', 'arg'], env={}).communicate() # how to make this a login shell?
My goal is to begin the subprocess with a clean environment and source the login script chain (etc/profile, ~/.bash_profile, etc.), which could be different for various users.