Pass arguments to Cygwin through a python program

1.5k views Asked by At

I came across bpython and tried to installed it on my windows system with the help of cygwin. Now, whenever I have to access bpython program I have to open cygwin and than write bpython inside the cygwin shell.

Now I am trying to automate the above process using a python script.So, that as soon as I write bpython.py in my windows command prompt it should directly open bpython shell for me.

My code:

import subprocess
subprocess.call('F:\cygwin\Cygwin.bat')

Using above code I am able to create cygwin process but than again I have to write bpython in cygwin terminal to get it working.

enter image description here

So, I was wondering can I directly pass bpython as an argument to the F:\cygwin\Cygwin.bat something like

F:\cygwin\Cygwin.bat bpython

which can directly open the bpython shell.

OR is it possible that

1) First I create cygwin process with the help of subprocess module.

2) Than I pass bpython as an argument.

Both the above task to be done by python program so that the end result is bpython shell.

Output of which bpython

enter image description here

1

There are 1 answers

3
icktoofay On BEST ANSWER

Create a file named bpython.bat (contents below) and put it in a directory in your Windows PATH:

@C:\cygwin\bin\bash.exe --login -c /usr/bin/bpython