Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14271

Unable to run certain python command from Cmake

$
0
0

I'm having following python code

    cmd = ["cmd.exe", "/c","C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Auxiliary/Build/vcvarsx86_amd64.bat", "^&^&", "set", "PATH", ">", temp_file_path    ]    print(cmd)    result = subprocess.run(cmd, capture_output=True)    if result.returncode != 0:        print(f"Error running vcvarsx86_amd64: {result.stderr.decode('utf-8')}")        sys.exit(1)

If I run this python script from the console eveything works fine.

But if I run it from inside cmake using the following command:

execute_process(    COMMAND ${PYTHON_CMD} script.py        --input_file ${INPUT_FILE}.dll        --output_file ${OUTPUT_FILE}.dll    RESULT_VARIABLE result    )

I got following error:

   ['cmd.exe', '/c', 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Auxiliary/Build/vcvarsx86_amd64.bat', '^&^&', 'set', 'PATH', '>', 'C:\\Users\\MYKOLA~1.GER\\AppData\\Local\\Temp\\tmpio00uuoh']   Error running vcvarsx86_amd64: The input line is too long.   The syntax of the command is incorrect.

Viewing all articles
Browse latest Browse all 14271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>