os.system vs subrocess.call
Ulrich Goebel
ml at fam-goebel.de
Thu Nov 28 06:07:40 EST 2019
Sorry for the wrong spelling. In fact
subprocess.call('./Test.py')
works.
The raising error was my error too, using ['./', 'Test.py'] instead of
'./Test.py'
Sorry...
Am 28.11.19 um 11:05 schrieb Ulrich Goebel:
> Hi,
>
> I have to call commands from inside a python skript. These commands are
> in fact other python scripts. So I made
>
> os.system('\.Test.py')
>
> That works.
>
> Now I tried to use
>
> supprocess.call(['.\', 'test.py'])
>
> That doesn't work but ends in an error:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python3.5/subprocess.py", line 557, in call
> with Popen(*popenargs, **kwargs) as p:
> File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
> restore_signals, start_new_session)
> File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
> raise child_exception_type(errno_num, err_msg)
> PermissionError: [Errno 13] Permission denied
>
> Using
>
> subprocess.call(['./', 'Test.py'], shell=True)
>
> I get
>
> Test.py: 1: Test.py: ./: Permission denied
>
> Is there a simple way to use subprocess in this usecase?
>
> Best regards
> Ulrich
>
--
Ulrich Goebel
Am Büchel 57, 53173 Bonn
More information about the Python-list
mailing list