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

Need to upgrade to use Python3 #11

Open
genterminl opened this issue Aug 31, 2019 · 4 comments
Open

Need to upgrade to use Python3 #11

genterminl opened this issue Aug 31, 2019 · 4 comments

Comments

@genterminl
Copy link

Running from git head:

jack $./lsdrv 
  File "./lsdrv", line 323
    os.mkdir('/dev/block', 0755)
                              ^
SyntaxError: invalid token

It seems this is due to Python 3 (3.6.5 in my case) where octals apparently need to be specified Oo0755. However, changing that line leads to other errors (missing parens for print is the next one) and explicitly running with Python2 it works fine.
I'm not a Python programmer, so I don't know how much effort this requires, or if there is simply a way to explicitly request Python2 in the meantime.

@CRCinAU
Copy link

CRCinAU commented Sep 21, 2023

@pturmel - Just wondering if you got anywhere with this?

I've used the script over the years to check my strages on Proxmox - but it no longer ships with Python 2.7 at all...

By changing the print statements to print(xxxx) - and then the permissions to 0oXXX - I've got to this point, and now I don't know what to do here:

Traceback (most recent call last):
  File "/root/bin/./lsdrv", line 423, in <module>
    probe_block('/sys/block/'+x)
  File "/root/bin/./lsdrv", line 342, in probe_block
    blk.__dict__.update(extractvars(runx(['blkid', '-p', '-o', 'udev', '/dev/block/'+blk.dev])))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/bin/./lsdrv", line 165, in extractvars
    for mo in varsre.finditer(buffer):
              ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot use a string pattern on a bytes-like object

@genterminl
Copy link
Author

It looks to me like the last commit to the code was over five years ago, so I have to wonder if this is now abandonware?

@pturmel
Copy link
Owner

pturmel commented Sep 21, 2023

Well, I'm still alive, but yes, low priority for quite some time now. Every time I look, I realize it needs substantial work to make it async-friendly in addition to the byte/string distinctions needed.

@CrimsonGlory
Copy link

I've just opened a PR with code changes that make the script work both in python 2 and 3.
#14

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

No branches or pull requests

4 participants