Using pre-commit python script in PowerPC
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
The following appears in the terminal when the pre-commit python script is used in command line.
1
2
3
4
5
./crucible.py <review-key>
Traceback (most recent call last):
File "./crucible.py", line 12, in <module>
import argparse
ImportError: No module named argparse
Cause
This happens if you are using python < 2.7 and/or the argparse modules are not installed.
Resolution
Download Python 2.7 packages found here for Debian or directly from python.org for other distributions and install them.
Installing manually:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Unpacking the downloaded file
tar -xzf Python-2.7.3.tgz
cd Python-2.7.3
# Configuring installation prefix
./configure --prefix=/usr --enable-shared
# Making everything before install
make
# Installing
sudo make install
cd ..
# Changing python binary priorities
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 20
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10
sudo update-alternatives --set python /usr/bin/python2.6
# Downloading and installing virtual environment.
wget http://peak.telecommunity.com/dist/ez_setup.py
sudo python2.7 ez_setup.py
sudo easy_install-2.7 virtualenv
# Installing pip
wget http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz
tar xzf pip-0.7.2.tar.gz
cd pip-0.7.2
sudo python setup.py install
# Installing argparse modules
pip install argparse
Was this helpful?