pip install gitpython fails with python 3.x requirement - python-2.7

When I try to install gitpython via pip normally under python 2.7, it fails telling me python 3.x is required.
This particular script/process has worked until this morning.
$ sudo pip install gitpython
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting gitpython
Using cached https://www.piwheels.org/simple/gitpython/GitPython-2.1.12-py2.py3-none-any.whl
GitPython requires Python '>=3.0, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*' but the running Python is 2.7.16
I am running Python 2.7.16
$ python --version
Python 2.7.16
When I check the current documentation I see that Python 2.7 or newer is listed as a requirement. What am I missing?

Turns out the documentation was lagging, and Python 2.7 support was dropped in dac619e.
Assuming other folks are procrastinating as I am in getting to Python 3, I've created a fork of GitPython which is current with 2.1.12 and reverts only those changes which eliminated stated compatibility for Python 2.7. My fork is expected to remain static with the 0.2.12a release and otherwise even with mainline GitPython 2.1.12.
I've created a small batch file for folks who may want/need to automate the installation process of this fork:
#!/bin/bash
gitpython() {
local cwd repo pipList found
pipList=$(pip list)
found=$(grep -o "GitPython" <<< "$pipList" | wc -l)
repo="https://github.com/lbussy/GitPython.git"
if [ "$found" -eq "0" ]; then
echo -e "\nDownloading and installing GitPython for Python 2.7."
cwd=$(pwd)
git clone "$repo" "$HOME/git-python" &>/dev/null || die "$#"
cd "$HOME/git-python" || die "$#"
eval "python setup.py install" &>/dev/null || die "$#"
cd "$cwd" || die "$#"
rm -fr "$HOME/git-python"
echo -e "\nGitPython for Python 2.7 install complete."
else
echo -e "\nGitPython for Python 2.7 already installed."
fi
}
function die
{
local message=$1
[ -z "$message" ] && message="Died"
echo "${BASH_SOURCE[1]}: line ${BASH_LINENO[0]}: ${FUNCNAME[1]}: $message." >&2
exit 1
}
main() {
gitpython "$#"
}
main "$?" && exit 0
Installed in this manner, it is still able to be managed by pip going forward.

Related

qemu quits when pressing ctrl-c in gdb

Debugging my own kernel with qemu and gdb seems to be unnecessarily hard because pressing ctrl-c in gdb to break qemu does not break it, but makes it quit with the message
qemu-system-x86_64: terminating on signal 2
[Inferior 1 (Remote target) exited normally]
qemu command line:
qemu-system-x86_64 -s -no-shutdown -no-reboot -enable-kvm -m 1G -smp cores=1 -cpu qemu64 -drive if=pflash,format=raw,file=ovmf/OVMF.fd -drive file=fat:rw:hda,format=raw -net none -debugcon file:debug.log -global isa-debugcon.iobase=0x402 &
The behavior is the same without KVM. Could someone please help, how to solve this?
qemu-system-x86_64 v3.1.0
gdb v8.2.1
I would like not to build the latest versions of these from source as it seems to be a daunting task to do.
EDIT: Created a minimal environment where the issue can be reproduced. I may have tracked it down to running the whole thing from a shell script, but can't seem to progress further. Commenting out the gdb call in the script and starting it from a separate terminal, solves the issue (however i like things that work with as few keystrokes as possible).
You can download it here.
Just start the script called qd
(Is there a nicer way to provide files? I will delete this after a while.)
I tested with QEMU 5.0.0 and GDB 9.2, same issue, and same solution, that is commenting out the GDB call in the script and starting it from a separate terminal. You could probably just modify your script so that QEMU would be started in another
terminal. Starting QEMU using nohup is not working either.
I included the script I am usually using for building fresh versions of QEMU and GDB: latest versions are likely to have fixed bugs. The script is working on Ubuntu 20.04, and is probably still working on 16.04 and 18.04 - you may have to make small adjustments at the beginning of the script. Feel free to report issues, I would be willing to fix them.
build-qemu-gdb.sh:
#!/bin/bash
set -e
# Xenial/16.04
PERL_MODULES_VERSION=5.22
SPHINX=python-sphinx
# Bionic/18.04
PERL_MODULES_VERSION=5.26
SPHINX=python-sphinx
# Focal/20.04
PERL_MODULES_VERSION=5.30
SPHINX="sphinx-doc sphinx-common"
# Qemu
QEMU_VERSION=5.0.0
PREFIX=/opt/qemu-${QEMU_VERSION}
# GDB
GDB_VERSION=9.2
do_get_gdb()
{
if [ -f gdb-${GDB_VERSION}.tar.xz ]
then
echo "gdb-${GDB_VERSION}.tar.xz is present."
else
wget http://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.xz
fi
}
do_get_qemu()
{
if [ -f qemu-${QEMU_VERSION}.tar.xz ]
then
echo "qemu-${QEMU_VERSION}.tar.xz is present."
else
wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz
fi
}
do_install_prerequisites()
{
sudo apt-get install libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev libaio-dev libbluetooth-dev libbrlapi-dev libbz2-dev libcap-dev libcap-ng-dev libcurl4-gnutls-dev libgtk-3-dev libibverbs-dev \
libjpeg8-dev libncurses5-dev libnuma-dev librbd-dev librdmacm-dev libsasl2-dev libsdl2-dev libseccomp-dev libsnappy-dev libssh2-1-dev libvde-dev libvdeplug-dev libvte-2.91-dev libxen-dev liblzo2-dev \
valgrind xfslibs-dev liblzma-dev flex bison texinfo gettext perl perl-modules-${PERL_MODULES_VERSION} ${SPHINX}
}
do_configure()
{
local TARGET_LIST="x86_64-softmmu"
pushd qemu-${QEMU_VERSION}
./configure --target-list="${TARGET_LIST}" --prefix=${PREFIX} --extra-cflags="-I$(pwd)/packages/include" --extra-ldflags="-L$(pwd)/packages/lib"
popd
}
do_extract_qemu()
{
echo "extracting QEMU..."
rm -rf qemu-${QEMU_VERSION}
tar Jxf qemu-${QEMU_VERSION}.tar.xz
}
do_build_qemu()
{
echo "building..."
pushd qemu-${QEMU_VERSION}
make all
popd
}
do_install_qemu()
{
echo "installing..."
pushd qemu-${QEMU_VERSION}
sudo make install
popd
}
do_build_qemu()
{
do_extract_qemu
do_configure
do_build_qemu
do_install_qemu
}
do_extract_gdb()
{
echo "extracting GDB..."
rm -rf gdb-${GDB_VERSION}
tar Jxf gdb-${GDB_VERSION}.tar.xz
}
do_build_gdb()
{
do_extract_gdb
rm -rf gdb
mkdir gdb
pushd gdb
../gdb-${GDB_VERSION}/configure --enable-tui --prefix=/opt/gdb-${GDB_VERSION}-x86_64-none-elf --target=x86_64-none-elf --program-prefix=x86_64-none-elf-
make all install
popd
}
# main
do_install_prerequisites
do_get_qemu
do_build_qemu
do_get_gdb
do_build_gdb
The resulting new paths for QEMU and GDB after installation would be:
/opt/qemu-5.0.0/bin/qemu-system-x86_64
/opt/gdb-9.2-x86_64-none-elf/bin/x86_64-none-elf-gdb

regarding about export of neptune data

I am trying to export Neptune RDF data using the following tools.
amazon-neptune-tools/neptune-export at master ยท awslabs/amazon-neptune-tools
https://github.com/awslabs/amazon-neptune-tools/tree/master/neptune-export
But, Error occurs.
Error
[ec2-user#bastin neptune-export]$ sh ./bin/neptune-export.sh export-rdf -e neptestdb-cluster.cluster-xxxxxx.ap-northeast-1.neptune.amazonaws.com -d /home/ec2-user/output
Creating statement files
Completed export-rdf in 1 seconds
An error occurred while exporting from Neptune:
java.lang.RuntimeException: java.lang.NullPointerException
at com.amazonaws.services.neptune.rdf.NeptuneSparqlClient.executeQuery(NeptuneSparqlClient.java:166)
at com.amazonaws.services.neptune.rdf.io.ExportRdfGraphJob.execute(ExportRdfGraphJob.java:31)
at com.amazonaws.services.neptune.ExportRdfGraph.run(ExportRdfGraph.java:55)
at com.amazonaws.services.neptune.NeptuneExportCli.main(NeptuneExportCli.java:54)
Caused by: java.lang.NullPointerException
at com.amazonaws.services.neptune.rdf.io.EnhancedTurtleWriter.handleStatement(EnhancedTurtleWriter.java:42)
at com.amazonaws.services.neptune.rdf.NeptuneSparqlClient$2.handleSolution(NeptuneSparqlClient.java:161)
at org.eclipse.rdf4j.query.resultio.binary.BinaryQueryResultParser.parse(BinaryQueryResultParser.java:192)
at org.eclipse.rdf4j.query.resultio.AbstractTupleQueryResultParser.parseQueryResult(AbstractTupleQueryResultParser.java:48)
at org.eclipse.rdf4j.http.client.SPARQLProtocolSession.getTupleQueryResult(SPARQLProtocolSession.java:693)
at org.eclipse.rdf4j.http.client.SPARQLProtocolSession.sendTupleQuery(SPARQLProtocolSession.java:372)
at org.eclipse.rdf4j.repository.sparql.query.SPARQLTupleQuery.evaluate(SPARQLTupleQuery.java:55)
at com.amazonaws.services.neptune.rdf.NeptuneSparqlClient.executeQuery(NeptuneSparqlClient.java:126)
... 3 more
[ec2-user#bastin neptune-export]$
The procedure is as follows.
Command
1. download tool
git clone https://github.com/awslabs/amazon-neptune-tools.git
2. install mvn for build
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
3. execute build
cd /home/ec2-user/amazon-neptune-tools/neptune-export
mvn clean install
4. exexute neptune-export.sh
cd /home/ec2-user/amazon-neptune-tools/neptune-export
sh ./bin/neptune-export.sh export-rdf -e https://neptestdb-cluster.cluster-xxxxxxx.ap-northeast-1.neptune.amazonaws.com -d /home/ec2-user/output
If you have any idea, please contact us.
thank you for your cooperation.
Thanks for reporting this. I've identified the problem and will push an update to the repository later today or tomorrow. In the meantime, you can replace line 42 in EnhancedTutleWriter.java with the following:
Resource context = statement.getContext();
if (context != null){
prefixes.parse(context.stringValue(), this);
}

When the command is executed python manage.py runserver

When the command is executed :
python manage.py runserver
error :
C:\Users\Mr-py-dj\Desktop\sageteam-project\venv\lib\site-packages\khayyam\algorithms.py:19: UserWarning: The C extension is not available. Switching to fallback python pure algorithms,so it's about 1000X slower than C implementation of the algorithms.
"The C extension is not available. Switching to fallback python pure algorithms,"
why???
Install build-essential and python2-dev or python3-dev
Download the latest release and extract. then
python setup.py build_ext --inplace
pip install -e .

How to completely replace python 3 with python 2 in arch linux

I want to completely replace python 3 with python 2 in arch linux. I have already read https://wiki.archlinux.org/index.php/Python but it only provides a temporary fix. I need to ensure that when I call
#!/usr/bin/python
My program is using python 2 instead of python 3.
In Arch, /usr/bin/python is actually a symlink to python3. Assuming you've already installed python2, as root, change the symlink to point to python2:
cd /usr/bin
ls -l python
lrwxrwxrwx 1 root root 7 5 sept. 07:04 python -> python3
ln -sf python2 python
ls -l python
lrwxrwxrwx 1 root root 7 Dec 11 19:28 python -> python2
If you're using the python2-virtualenv package, then do the same for /usr/bin/virtualenv:
cd /usr/bin
ln -sf virtualenv2 virtualenv
Changing the default symlink is a bad idea, and it gets recreated on python3 updates. Instead, create a local python override:
sudoedit /usr/local/bin/python
Paste this inside and save the file:
#!/bin/bash
exec python2 "$#"
Don't forget to make it executable:
sudo chmod +x /usr/local/bin/python

How to do wapiti security test step by step procedure in windows 7 (Its show no error)

Installed python 2.7
D:\wapiti\wapiti-2.2.1\src> python wapiti.py <server url>/ -s
i didnt get any errors. i got one html file with no error
D:\wapiti\wapiti-2.2.1\src> python wapiti.py http://serverdomain/Dashboard/Index/ -u
D:\wapiti\wapiti-2.2.1\net> python getcookie.py http://serverdomain/Dashboard/Index/ -c <file url>
D:\wapiti\wapiti-2.2.1\src> python wapiti.py http://serverdomain/Dashboard/Index/ -a username%password
1.You download the zip (wapiti-2.3.0-win32-standalone) package,extract it and change directory into it (e.g. cd wapiti-2.0.X)
2.Install the Python 2.6 or 2.7 on window machine.
Execute the below command using cmd :-
#wapiti-getcookie cookies.json http://stage.xxxxxxx.com/login
#wapiti http://stage.xxxxxxxx.com -c cookies.json -x http://stage.xxxxxxx.com/logout