SwatchBooker icon indicating copy to clipboard operation
SwatchBooker copied to clipboard

Switch to python 3

Open luyatshimbalanga opened this issue 6 years ago • 6 comments

Per announcement: https://legacy.python.org/dev/peps/pep-0373/, python 2 will reach end of life next year. It will be nice swatchbooker convert all python 2 to python 3.

luyatshimbalanga avatar Feb 17 '19 19:02 luyatshimbalanga

Unfortunately at this point in time because of this, I am no longer able to install this in Arch Linux or its derivatives. If anyone knows of any SwatchBooker alternatives please share.

eGax avatar Apr 04 '21 19:04 eGax

sk1-color-picker https://sk1project.net/color-picker/daily-builds/ imports/exports palettes for following applications:

sK1 Inkscape GIMP Scribus Karbon Calligra LibreOffice CorelDRAW, Corel PhotoPaint Adobe Illustrator, Adobe InDesign Adobe Photoshop Xara Designer, Xara Web Designer

maxim-s-barabash avatar Apr 04 '21 21:04 maxim-s-barabash

Doesn't look like a replacement for a palette editor like SwatchBooker at all from what I can see. Hard to tell though since I can't get sk1 color picker to work in Arch or Manjaro Linux. There is no shortage of color pickers on Linux, but no palette editors beyond SwatchBooker that I can find.

I did find something close in functionality : Gpick

eGax avatar Apr 12 '21 14:04 eGax

continue from: https://bugs.launchpad.net/swatchbooker/+bug/1997677

~/c$ git clone https://github.com/olivierberten/SwatchBooker.git
~/c$ cd SwatchBooker

I'm on Debian 11, here Python is Pyhon3.9, but package Python2.7 create a link in /usr/bin named 'python2' So I changed all the shebang in .py and .pyw files to #!/usr/bin/env python2

As so I can run:

~/c/SwatchBooker$ setup.py build
~/c/SwatchBooker$ sudo setup.py install --prefix /opt/SwatchBooker

than I had to manually modify /opt/SwatchBooker/bin/swatchbooker as so:

#!/bin/sh 
PROGRAM=/opt/SwatchBooker/lib/swatchbooker/swatchbooker.pyw
PYTHON=`which python2`
$PYTHON $PROGRAM ;

and manually made executable: $ sudo chmod +x /opt/SwatchBooker/bin/swatchbooker

Running it say:

$ swatchbooker
Traceback (most recent call last):
  File "/opt/SwatchBooker/lib/swatchbooker/swatchbooker.pyw", line 26, in <module>
    from PIL import ImageQt
ImportError: No module named PIL

there is a package 'python3-pil' (Python Imaging Library) for Python 3.9, but seems there's no package PIL for Python 2.7 in current Debian. It was in Stretch 9 and Buster 10 but removed from Bullseye 11: https://packages.debian.org/search?keywords=python-pil So I'm stopped again.

Any solution?

efa avatar Nov 24 '22 21:11 efa

following instruction at: https://www.how2shout.com/linux/install-python-3-x-or-2-7-on-debian-11-bullseye-linux/ I installed pip2 and then: $ pip2 install pillow DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. Defaulting to user installation because normal site-packages is not writeable Collecting pillow Downloading Pillow-6.2.2-cp27-cp27mu-manylinux1_x86_64.whl (2.1 MB) |████████████████████████████████| 2.1 MB 1.5 MB/s Installing collected packages: pillow Successfully installed pillow-6.2.2

Now running swatchbooker I got this PyQt5.QtCore missing error:

/opt/SwatchBooker/bin$ swatchbooker
Traceback (most recent call last):
  File "/opt/SwatchBooker/lib/swatchbooker/swatchbooker.pyw", line 28, in <module>
    from sbcommon import *
  File "/opt/SwatchBooker/lib/swatchbooker/sbcommon.py", line 23, in <module>
    from PyQt5.QtCore import *
ImportError: No module named PyQt5.QtCore

but then:

$ pip2 install python-qt5
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting python-qt5
  Downloading python-qt5-0.1.10.zip (57.5 MB)
     |████████████████████████████████| 57.5 MB 1.7 MB/s 
ERROR: No .egg-info directory found in /tmp/pip-pip-egg-info-60bCBl

efa avatar Nov 24 '22 22:11 efa

  1. made a fake package with this script:
#!/bin/bash
# create the package structure:
pkg=qtbase-abi
ver=5.11.3
v=`echo $ver | sed 's/\./-/g'`

mkdir $pkg-$ver-fake
mkdir -p $pkg-$ver-fake/DEBIAN
mkdir -p $pkg-$ver-fake/usr/lib/$pkg-$ver-fake
touch $pkg-$ver-fake/usr/lib/$pkg-$ver-fake/nothing.txt

# create the deb control file (the guts):
cat <<_EOF > $pkg-$ver-fake/DEBIAN/control
Package: $pkg-$ver-fake
Version: $ver
Section: custom
Priority: optional
Architecture: all
Essential: no
Installed-Size: 1024
Maintainer: atlas
Description: Fakes out python-pyqt5 from Debian 10 to work on 11
Provides: $pkg-$v
_EOF

# build the $pkg-$ver-fake.deb file:
dpkg-deb --build $pkg-$ver-fake

# clean dir
rm -rf $pkg-$ver-fake
  1. install it: $ sudo dpkg -i qtbase-abi-5.11.3-fake.deb

  2. download those package from Debian 10 repo:

python-enum34_1.1.6-2_all.deb
python-sip_4.19.14+dfsg-2_amd64.deb
python-pyqt5_5.11.3+dfsg-1+b3_amd64.deb
  1. install them: $ sudo dpkg -i python-enum34_1.1.6-2_all.deb python-sip_4.19.14+dfsg-2_amd64.deb python-pyqt5_5.11.3+dfsg-1+b3_amd64.deb

  2. modify /opt/SwatchBooker/bin/swatchbooker as so:

#!/bin/sh

PROGRAM=/opt/SwatchBooker/lib/swatchbooker/swatchbooker.pyw
PYTHON=`which python2`
export PYTHONPATH=/opt/SwatchBooker/lib/python2.7/site-packages:$PYTHONPATH

$PYTHON $PROGRAM ;

now Swatchbooker start and work correctly

Anyway this is a dirty hack, please upgrade to Python 3, I think Debian will remove Python2 next year

efa avatar Nov 25 '22 00:11 efa