wolfc01 / procexp

Process explorer for linux
GNU General Public License v3.0
97 stars 21 forks source link

Update to PyQt5 and Python 3 #15

Closed allenh1 closed 4 years ago

allenh1 commented 4 years ago

When I tried using this on my machine, I got a lot of errors because it wanted PyQt4 and Python2, so I ported it to Python3 and PyQt5.

I tested most of it, seems to work (but I would recommend it be tested by people who are more familiar with this project, since I haven't used this before I went through and ported it).

eventhorizon5 commented 4 years ago

I tried using your modifications on my system, and I'm still having errors in Python with it. My system is running Debian Testing, and they recently dropped Qt4 (part of the Qt5 transition) which broke procexp. I tried doing some modifications myself but it still doesn't appear to work properly, and still has a number of exceptions.

allenh1 commented 4 years ago

I tried using your modifications on my system, and I'm still having errors in Python with it.

@eventhorizon5 I appreciate you testing it! I didn't thoroughly test it when I did, so I'm not very surprised. If you could give me some steps to reproduce some of the errors you see, I'll be glad to fix those and push the changes to this branch.

eventhorizon5 commented 4 years ago

@allenh1 I actually tried fixing the bugs myself, but there were too many at the time. I might try again soon. The easiest way for you is if you can spin up a VM with either Debian Testing or possibly the latest Ubuntu (20.04) which might work too. Here's a link to the Debian ISOs which are generated weekly, if you want to try: https://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-dvd/

Debian Testing is a rolling distribution that updates daily, after packages have been tested in "Unstable", and so the packages are fairly current while not exactly being bleeding-edge.

I'd love if development continued on this Procexp project, since I was a fan of the original Windows version but I've been using Linux almost exclusively for a long time now.

allenh1 commented 4 years ago

I'd be willing to take over if this repository is dead, honestly. I'm also a fan of the original.

I'm running on Ubuntu 20.04 at the moment, with PyQt5 and Python 3.8.

I only gave a cursory test of it, if you tell me a sequence of actions that leads to am exception I'd be glad to fix it.

allenh1 commented 4 years ago

@wolfc01 do you intend on actively maintaining this repository?

eventhorizon5 commented 4 years ago

Here's what I'm getting on Debian Stable, on my laptop. My Debian Testing desktop machine is having maybe power supply problems, so I can't use it at the moment (system keeps resetting abruptly).

ryan@t420:~/procexp$ python3 procexp.py Call to main app created: '<PyQt5.QtWidgets.QApplication object at 0x7fbd73ad0ca8>' Traceback (most recent call last): File "procexp.py", line 573, in g_reader = procreader.reader.procreader(int(g_settings["updateTimer"]), int(g_settings["historySampleCount"])) File "/home/ryan/procexp/procreader/reader.py", line 194, in init for line in data[0].split("\n"): TypeError: a bytes-like object is required, not 'str'

System is running Python 3.7.3 and appears to be using QT 5.11.3. Don't know what Testing is using at the moment.

eventhorizon5 commented 4 years ago

Tried Debian Testing while the machine was working, and it appears to be having the same issue. I don't have time right now to try fixing it myself, but I think you have to put a "b" identifier before the string definition for those, to identify them as a binary element. Testing is running Python 3.8.3 and QT 5.12.5.

eventhorizon5 commented 4 years ago

Looks like it only needed 2 edits for it to work on my machine. Here's a diff I made:

procexp.txt

eventhorizon5 commented 4 years ago

Spoke a little too soon - found some exceptions while running the app. Here's an updated diff, that seems to have it working well now.

procexp.txt

allenh1 commented 4 years ago

Great! I'll add those in. Thanks!

allenh1 commented 4 years ago

@eventhorizon5 I committed those changes under your name, let me know if you want me to edit the commit message to read something else. Thanks for the patch!

allenh1 commented 4 years ago

I am going to revert one of the small changes, I get the following when I try to run it.

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
app created: '<PyQt5.QtWidgets.QApplication object at 0x7fa0858be670>'
Traceback (most recent call last):
  File "./procexp.py", line 573, in <module>
    g_reader = procreader.reader.procreader(int(g_settings["updateTimer"]), int(g_settings["historySampleCount"]))
  File "/usr/local/src/procexp/procreader/reader.py", line 194, in __init__
    for line in data[0].split(b"\n"):
TypeError: must be str or None, not bytes

This is patch resolves it. Do you get an issue here if it's not bytes? How are you invoking this?

diff --git a/procreader/reader.py b/procreader/reader.py
index 015ee3b..f57fa61 100644
--- a/procreader/reader.py
+++ b/procreader/reader.py
@@ -191,8 +191,8 @@ class procreader(object):
         ethtoolerror = True

       if data[0] is not None:
-        for line in data[0].split(b"\n"):
-          if line.find(b"Speed") != -1:
+        for line in data[0].split("\n"):
+          if line.find("Speed") != -1:
             try:
               speed = int(line.split(":")[1].split("Mb/s")[0])
             except:
eventhorizon5 commented 4 years ago

This was actually done on a Debian Stable machine, don't know if that's the reason it was showing up (Python 3.7.3).

Here's the output from the Stable machine, from running the python.py directly:

Call to main app created: '<PyQt5.QtWidgets.QApplication object at 0x7fb34204ec18>' Traceback (most recent call last): File "./procexp.py", line 573, in g_reader = procreader.reader.procreader(int(g_settings["updateTimer"]), int(g_settings["historySampleCount"])) File "/opt/procexp/procreader/reader.py", line 195, in init if line.find("Speed") != -1: TypeError: argument should be integer or bytes-like object, not 'str'

I tried using the Testing machine, but it's having so many issues right now that I can't seem to do a test. I'll see if I can test on that machine later.

wolfc01 commented 4 years ago

Hi

do you intend on actively maintaining this repository? Currently not. Because of lack of time. I can give you full access to this repo, so you can help. How about it?

Br Carl.

Op za 27 jun. 2020 01:59 schreef Hunter L. Allen notifications@github.com:

@wolfc01 https://github.com/wolfc01 do you intend on actively maintaining this repository?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wolfc01/procexp/pull/15#issuecomment-650456224, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ5CCAYXKZRJ7ZPVFBOYDLRYUY6JANCNFSM4OD75MSQ .

wolfc01 commented 4 years ago

@wolfc01 do you intend on actively maintaining this repository?

Hi,

I gave you access already to the procexp repo. Let's discuss some maintaining. I can test because i still know what procexp is supposed to do.

Automatic tests of this tool seems to be quite complicated, so I never finished creating automatic tests.

Br Carl.

allenh1 commented 4 years ago

I gave you access already to the procexp repo.

Great! Thank you very much!

I can test because i still know what procexp is supposed to do.

That would be great for at least the current patch.

Automatic tests of this tool seems to be quite complicated, so I never finished creating automatic tests.

Yeah, that sort of thing can become quite tedious. As I hinted above, it would be great for you to not have to test everything. I've done python testing before in projects like superflore, and would be glad to add some things like that to this repository.

@wolfc01 Proceeding with this patch, should a new branch be created to merge this in and begin testing, or should we just tag the current master as a working copy, merge to master, and begin working on PR's that add some test coverage?

wolfc01 commented 4 years ago

Hi

Just use master as the working repo until we achieve a stable situation using procexp under the most modern and well known distro's using python3 / pyqt5 latest version.

Before starting: tag the current state as a "workable" thing.

Then we can start working with merge requests on a stable repo.

Br Carl.

Op zo 28 jun. 2020 16:28 schreef Hunter L. Allen notifications@github.com:

I gave you access already to the procexp repo.

Great! Thank you very much!

I can test because i still know what procexp is supposed to do.

That would be great for at least the current patch.

Automatic tests of this tool seems to be quite complicated, so I never finished creating automatic tests.

Yeah, that sort of thing can become quite tedious. As I hinted above, it would be great for you to not have to test everything. I've done python testing before in projects like superflore https://github.com/ros-infrastructure/superflore, and would be glad to add some things like that to this repository.

@wolfc01 https://github.com/wolfc01 Proceeding with this patch, should a new branch be created to merge this in and begin testing, or should we just tag the current master as a working copy, merge to master, and begin working on PR's that add some test coverage?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wolfc01/procexp/pull/15#issuecomment-650768903, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ5CCCLVMY4RFVWMDU7SYLRY5HPLANCNFSM4OD75MSQ .

eventhorizon5 commented 4 years ago

I tried Debian Testing now, and it's having the same issues as Stable was. I don't know why yours with Ubuntu would be different.

allenh1 commented 4 years ago

Tagged the original as 0.1.0, I'll let @wolfc01 hit the merge button on this one.

Excited to get this going again!

I tried Debian Testing now, and it's having the same issues as Stable was. I don't know why yours with Ubuntu would be different.

I'm not sure what's breaking things for @eventhorizon5, but I'll give it a go on my Gentoo installation next time I get a chance (so we have another example).

wolfc01 commented 4 years ago

Sorry for the delay, but finally merged!

wolfc01 commented 4 years ago

Hi All,

The requested merge button has been hit successfully.

Br Carl

Op di 30 jun. 2020 16:51 schreef Hunter L. Allen notifications@github.com:

Tagged the original as 0.1.0, I'll let @wolfc01 https://github.com/wolfc01 hit the merge button on this one.

Excited to get this going again!

I tried Debian Testing now, and it's having the same issues as Stable was. I don't know why yours with Ubuntu would be different.

I'm not sure what's breaking things for @eventhorizon5 https://github.com/eventhorizon5, but I'll give it a go on my Gentoo installation next time I get a chance (so we have another example).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wolfc01/procexp/pull/15#issuecomment-651844429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ5CCDBZP6VUORWXWTIXH3RZH3WLANCNFSM4OD75MSQ .