Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requires python2.7 breaks on python3 #1

Open
majorcrash opened this issue Dec 29, 2018 · 5 comments · May be fixed by #3
Open

Requires python2.7 breaks on python3 #1

majorcrash opened this issue Dec 29, 2018 · 5 comments · May be fixed by #3

Comments

@majorcrash
Copy link

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
Copy link

thefantas commented Dec 4, 2019

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
Copy link

devZer0 commented Feb 12, 2023

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

@devZer0
Copy link

devZer0 commented Feb 12, 2023

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
Copy link

enriluis commented Aug 18, 2023

nice!
thanks !
image

@albfan
Copy link

albfan commented Nov 4, 2023

This deserves a PR! #3

@albfan albfan linked a pull request Nov 4, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants