0

I'm new to python and I'm trying to run my cmake via python program using subprocess. this is my code:

test_path = "/home/yaodav/Desktop/test_clone_git/test/"
cmake_build_command = "cmake -Bcmake-debug-build -H. -DCMAKE_BUILD_TYPE=debug -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/c++ -Bcmake-debug-build -H. -DSYTEM_ARCH=x86_64-pc-linux-gnu-gcc-7.4.0"
cmake_link_command = "cmake --build cmake-debug-build --target all"
cmake_command = [test_path, cmake_build_command, cmake_link_command]

try:
    out = subprocess.run(cmake_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    stdout, stderr = out.communicate()
    print(stdout)
    print(stderr)
except Exception as e:
    print(e)    

but when I'm running it im getting

'Permission denied'

I checked my python file permission and

-rwxrwxrwx. 1 yaodav yaodav 4387 Nov 3 05:05 git_puller.py

how do I fix it?

yaodav
  • 1,126
  • 12
  • 34
  • The first argument to the `subprocess.run()` (or `subprocess.Popen()`) is either a **list**, which **first element** is a **program** and others - the program's argument, or a single **string** containing a **command line** (a program and its arguments separated by a space). But you pass a **list** of **command lines**. This wouldn't work. – Tsyvarev Nov 03 '19 at 18:33
  • so how do I send few commands and not just one? – yaodav Nov 03 '19 at 19:46

0 Answers0