mythic-beasts / pvshrink

Automate shrinking of an LVM PV
34 stars 11 forks source link

Requires python2.7 breaks on python3 #1

Open majorcrash opened 5 years ago

majorcrash commented 5 years ago

On Ubuntu 18.04

  1. Does not run as is on vanilla ubuntu 18.04. The default path for python is /usr/bin/python3
  2. Manually install python2.7 then the shebang needs to be altered to run:

    !/usr/bin/python2.7

  3. If shebang is altered to /usr/bin/python3 the following error is produced: sudo ./pvshrink /dev/sdf Traceback (most recent call last): File "./pvshrink", line 55, in for seg in pvs.split("\n"): TypeError: a bytes-like object is required, not 'str'
thefantas commented 4 years ago

To make it work with python3.7 modify this line. Line 55:

for seg in pvs.split("\n"):

Replace:

for seg in pvs.decode().split("\n"):

devZer0 commented 1 year ago

that's not enough to make pvshrink python compatible, there are other errors

devZer0 commented 1 year ago

after some search i found a version which seems to correctly being ported to python3 and which apparently also still works with python2 :

https://github.com/sensimple-contrib/pvshrink

these are the 2 commits which make it python2 compatible:

https://github.com/sensimple-contrib/pvshrink/commits?author=jsalatiel

could you apply those to your version @pdw-mb ?

what about submitting this upstream to the lvm2 project at http://sourceware.org/lvm2/ ?

this is a very useful tool !

enriluis commented 1 year ago

nice! thanks ! image

albfan commented 1 year ago

This deserves a PR! #3