Skip to content
Advertisement

Tag: bash

How can I call ‘git pull’ from within Python?

Using the github webhooks, I would like to be able to pull any changes to a remote development server. At the moment, when in the appropriate directory, git pull gets any changes that need to be made. However, I can’t figure out how to call that function from within Python. I have tried the following: But this results in the

Change working directory in shell with a python script

I want to implement a userland command that will take one of its arguments (path) and change the directory to that dir. After the program completion I would like the shell to be in that directory. So I want to implement cd command, but with external program. Can it be done in a python script or I have to write

Python ‘source HOME/.bashrc’ with os.system()

I am writing a python script (Linux) that is adding some shell aliases (writes them to HOME/.bash_aliases). In order to make an alias available immediately after it was written I should issue the following bash built-in: source is a bash built-in so I cannot just: If i try something like: …will freeze the script (just like is waiting for something).

Advertisement