[PYTHON] Notes on using post-receive and post-merge

I was able to fix a bug that I couldn't fix so far, so make a note of it.

Usual environment:

local: git push origin master
↓
remote(bare): post-git pull with receive
↓
remote(cloned): post-python script execution with merge

With these preferences, run the post-merge script and When ʻimporta third-party module in that script (The module is properlypip install), For some reason git push` raises ** ImportError ** on that third party module

The reason why I get such an error is that I have multiple Pythons installed in remote and unintended Pythons are running (ie I don't use the location where I did pip install). Python is used).

For example

  1. /usr/bin/python
  2. $HOME/.pythonbrew/pythons/Python-2.7.3/bin/python

I want to use ** 2 ** Python when I have two, but ** 1 ** Python is running.

So don't just run post-merge.py, When I bite ** shellscript ** and run it, it ran successfully.

In other words

post-merge.sh


#!/bin/sh

BIN="$HOME/.pythonbrew/pythons/Python-2.7.3/bin/python"

$BIN $HOME/path/repo/post-merge.py

post-merge.py



import flask


Ah, good, this works.

Recommended Posts

Notes on using post-receive and post-merge
Notes on using Alembic
Notes on installing Python3 and using pip on Windows7
Notes on tf.function and Tracing
Notes on * args and ** kargs
[Django] Notes on using django-debug-toolbar
Notes on pyenv and Atom
Notes on optimization using Pytorch
Notes on Python and dictionary types
Notes on installing Python using PyEnv
Notes on using rstrip with python.
Notes on using matplotlib on the server
(Beginner) Notes on using pyenv on Mac
Notes for using OpenCV on Windows10 Python 3.8.3.
Notes using cChardet and python3-chardet in Python 3.3.1.
Notes on building Python and pyenv on Mac
Notes on implementing APNs tests using Pytest
Notes on using OpenCL on Linux on the RX6800
Notes on using code formatter in Python
Notes on Flask
Notes on setting pyenv and python environment using Homebrew on Mac OS Marvericks
Difference between using and import on shield language
Notes on using dict in python [Competition Pro]
Notes for using TensorFlow on Bash on Ubuntu on Windows
[Python] Notes on accelerating genetic algorithms using multiprocessing
Initial settings for using Python3.8 and pip on CentOS8
Easy verification series on Katacoda "Installing and using Cockpit"
Notes on HDR and RAW image processing with Python
Celery notes on Django
Notes on installing PycURL
Notes using Python subprocesses
Notes on SciPy.linalg functions
Minimum notes when using Python on Mac (Homebrew edition)
Notes on building TinyEMU and booting the Linux kernel on Emscripten
Building a Python environment on a Mac and using Jupyter lab
IP spoof using tor on macOS and check with python
Notes on deploying pyenv with Homebrew and managing Python versions
[Python] Notes on while statements (writing style and infinite loop)
Notes on reading and writing float32 TIFF images in python
Python notes using perl-ternary operator
Python on Ruby and angry Ruby on Python
Notes on installing dlib on mac
Notes on python's sqlite3 module
Python notes using perl-special variables
Try using OpenCV on Windows
Recording and playback on Linux
Notes on defining PySide slots
[Python] Notes on data analysis
Notes on installing Python on Mac
Notes on studying multidimensional scaling
Process on GPU using chainer.cuda.elementwise
When using if and when using while
This and that using reflect
Try using pytest-Overview and Samples-
Notes on installing pipenv on Mac
Catalina on Mac and pyenv
Broadcast on LINE using python
Notes on installing Anaconda 3 on Windows
Notes on imshow () in OpenCV
Notes on installing Python on CentOS
Build a game leaderboard on Alibaba cloud using Python and Redis