[issue32760] [Python Shell command issue]

2018-02-05 Thread JamesDinh

JamesDinh  added the comment:

Hi,

>From this stackoverflow thread:
https://stackoverflow.com/questions/716011/why-cant-environmental-variables-set-in-python-persist

I find out there is an abnormal environment variable setting affects by using 
shell command.
Do you have some explanation for the shell command runs?
For your information, if I run below commands:
os.system("export MYENVPATH=/opt/toolchain/gcc")
os.system("./configure O=output project_name debug initramfs nofirewall && make 
O=output")
Then the configure command can't detect the MYENVPATH value.

--

___
Python tracker 
<https://bugs.python.org/issue32760>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32760] [Python Shell command issue]

2018-02-03 Thread JamesDinh

New submission from JamesDinh :

Hi Python dev. team,

I would like to report below error:
1) Tittle: Running Linux shell command from python file always leads to reset 
config error.

2) Environment:
+ Linux distro: Both Ubuntu 16.04 64b and Fedora 25 happen this issue
+ Python:
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2

3) Reproduce route:
These commands can be run normally from Linux terminal:
[I use buildroot for my embedded project]
./configure O=output project_name debug initramfs nofirewall
make O=output

But when I tried to call them from Python file, the configure command always 
lead to Restart config... - and all the new configuration values are discarded.

For your information, I tried these options:
a) 
spkConfigureCmd = ["./configure","O=output", 
"project_name","debug","initramfs","nofirewall"]
subprocess.check_call(spkConfigureCmd)
spkBuildCmd = ["make","O=output"]
subprocess.check_call(spkBuildCmd)

b) os.system("./configure O=output project_name debug initramfs nofirewall && 
make O=output")

c)
fid = open('ax2spkbuild.sh','w')
fid.write('./configure O=output project_name debug initramfs nofirewall\n')
fid.write('make O=output\n')
fid.close()
os.system('chmod +x ax2spkbuild.sh')
os.system('./ax2spkbuild.sh')

Actually I tried with another simple command like 'pwd', 'cat', 'echo' and they 
are working well. I wonder how come Python executes the Linux shell commands, 
which are slightly different to the Terminal typed commands.

--
components: Build
messages: 311572
nosy: JamesDinhBugPython
priority: normal
severity: normal
status: open
title: [Python Shell command issue]
type: behavior
versions: Python 2.7

___
Python tracker 
<https://bugs.python.org/issue32760>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com