running git command from a python script in git bash

A forum for general discussion of the Python programming language.

running git command from a python script in git bash

Postby carmel » Sun Oct 20, 2013 10:50 am

My enviroment:
working on windows.
python 3
using git bash

I'm trying to run git command from a python script (in git bash program).

Code: Select all
>>> import os
>>> os.chdir("C:/my/git/repo")
>>> os.system("git status")
'git' is not recognized as an internal or external command,
operable program or batch file.


This works when running from cmd.exe BUT does not work when running from git bash

thanks.
Last edited by stranac on Sun Oct 20, 2013 11:12 am, edited 1 time in total.
Reason: First post lock. Made the letters readable.
carmel
 
Posts: 1
Joined: Sun Oct 20, 2013 10:40 am

Re: running git command from a python script in git bash

Postby micseydel » Sun Oct 20, 2013 6:34 pm

You probably need to modify your bash PATH. There's probably a .bashrc file or something to do so, but I'm not sure if there's something special to doing it on bash on windows.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1497
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Discussions

Who is online

Users browsing this forum: Bing [Bot], Google Feedfetcher and 2 guests