Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105895

Using python heredoc to substitute the external file read by python script.

From Hongyi Zhao <hongyi.zhao@gmail.com>
Newsgroups comp.lang.python
Subject Using python heredoc to substitute the external file read by python script.
Date 2016-03-28 08:07 +0000
Organization NPO RUSnet InterNetNews site
Message-ID <ndaool$m2u$1@aspen.stu.neva.ru> (permalink)

Show all headers | View raw


Hi all,

See the following python codes:

import os
from subprocess import check_output

# POSIX: name shall not contain '=', value doesn't contain '\0'
output = check_output("source /home/werner/env-intel-toolchains.sh;
         env -0", shell=True, executable="/bin/bash")


In the above codes, I use the file /home/werner/env-intel-toolchains.sh 
for subprocess.check_output to use for its operation.

If I want to use python heredoc to substitute this external file for the 
above codes.  Is this possible?  

Regards
-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Using python heredoc to substitute the external file read by python script. Hongyi Zhao <hongyi.zhao@gmail.com> - 2016-03-28 08:07 +0000
  Re: Using python heredoc to substitute the external file read by python script. Ben Finney <ben+python@benfinney.id.au> - 2016-03-28 21:29 +1100
    Re: Using python heredoc to substitute the external file read by python script. Hongyi Zhao <hongyi.zhao@gmail.com> - 2016-03-28 12:01 +0000
      Re: Using python heredoc to substitute the external file read by python script. Ben Finney <ben+python@benfinney.id.au> - 2016-03-29 05:59 +1100

csiph-web