Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

You could use a multiline string so that the environment is modified in the same shell process:

from subprocess import check_call
check_call("""
source /etc/profile.d/modules.sh
module purge
module load intel
./my_code
""", shell=True, executable="/bin/bash")

See also Calling the "source" command from subprocess.Popen Calling the "source" command from subprocess.Popen

You could use a multiline string so that the environment is modified in the same shell process:

from subprocess import check_call
check_call("""
source /etc/profile.d/modules.sh
module purge
module load intel
./my_code
""", shell=True, executable="/bin/bash")

See also Calling the "source" command from subprocess.Popen

You could use a multiline string so that the environment is modified in the same shell process:

from subprocess import check_call
check_call("""
source /etc/profile.d/modules.sh
module purge
module load intel
./my_code
""", shell=True, executable="/bin/bash")

See also Calling the "source" command from subprocess.Popen

added 107 characters in body
Source Link
jfs
  • 417.3k
  • 211
  • 1k
  • 1.7k

You could use a multiline string so that the environment is modified in the same shell process:

from subprocess import check_call
check_call("""
source /etc/profile.d/modules.sh
module purge
module load intel
./my_code
""", shell=True, executable="/bin/bash")

See also Calling the "source" command from subprocess.Popen

You could use a multiline string so that the environment is modified in the same shell process:

from subprocess import check_call
check_call("""
source /etc/profile.d/modules.sh
module purge
module load intel
./my_code
""", shell=True, executable="/bin/bash")

You could use a multiline string so that the environment is modified in the same shell process:

from subprocess import check_call
check_call("""
source /etc/profile.d/modules.sh
module purge
module load intel
./my_code
""", shell=True, executable="/bin/bash")

See also Calling the "source" command from subprocess.Popen

Source Link
jfs
  • 417.3k
  • 211
  • 1k
  • 1.7k

You could use a multiline string so that the environment is modified in the same shell process:

from subprocess import check_call
check_call("""
source /etc/profile.d/modules.sh
module purge
module load intel
./my_code
""", shell=True, executable="/bin/bash")
default

AltStyle によって変換されたページ (->オリジナル) /