How can I run a shell script instead of python in a PyCharm run configuration?

前端 未结 4 995
眼角桃花
眼角桃花 2021-02-11 16:47

I am trying to setup PyCharm to invoke a shell script, instead of python, as the run option. Is this possible? In the default options I only have Python, Python docs, and Python

4条回答
  •  迷失自我
    2021-02-11 16:54

    I think the easiest way is to just write a python script that calls the .bat file, and then run that:

    from subprocess import Popen
    
    p = Popen("batch.bat", cwd=r"C:\Path\to\batchfolder")
    stdout, stderr = p.communicate()
    

提交回复
热议问题