0

I am making a simple code to automate my tedious task. I have installed ubuntu in wsl. I have used tkinter, and used a button to execute few commands in bash.

os.chdir(root.destiny)
bash = 'blockMesh'
pipefile = open('output', 'w')
retcode = call(bash, shell=True, stdout=pipefile)
pipefile.close()
os.remove('output')
os.chdir("..")

Below is the error that i am facing: ('blockMesh' is not recognized as an internal or external command, operable program or batch file.)

Elaborating: I am trying to create a mesh, changes is made using editing files in one of the folder. I need to run the a command in that particular folder 'blockMesh' which will run few codes to create a mesh.

Can someone help me with the same. I tried making 'bash' to 'cmd' in the code but didn't work. Need a helping hand.

Thanks

12
  • 1
    "unable to run" is a bad problem description. Please start with the tour and read How to Ask. Further, try to solve this one thing in isolation, then you also have the mandatory minimal reproducible example for your question here. BTW: It's unclear in what system you're running your code. The correct way might depend on that. Commented Jul 5, 2022 at 5:45
  • over here my 'bash code' is 'blockMesh'. I am using pycharm, python 3.10. The error i am facing is ('blockMesh' is not recognized as an internal or external command, operable program or batch file.) Commented Jul 5, 2022 at 5:52
  • bash is a shell that does not run on windows except under WSL ... batch is the shell language of cmd.exe Commented Jul 5, 2022 at 5:54
  • So there isn't any way i can run the bash command in windows using python? I have already installed WSL. I can open bash from start program. Commented Jul 5, 2022 at 6:09
  • Add all that info to your question, you can edit it! BTW, there are bash ports to MS Windows, you don't need WSL for it. However, I'd first look at the actual goal rather than focusing on a specific tool. Commented Jul 5, 2022 at 7:43

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.