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

stuck on 100% #2

Open
eLBati opened this issue Mar 24, 2017 · 10 comments
Open

stuck on 100% #2

eLBati opened this issue Mar 24, 2017 · 10 comments

Comments

@eLBati
Copy link

eLBati commented Mar 24, 2017

Package: indicator-doom-cpu
Version: 1.0.0
Ubuntu 16.04

When I first start the indicator, it works correctly.
When i reboot the system, the indicator is stuck on 100%:
doom

If I quit the indicator and start it again, it works correctly.

Thanks

@ebruck
Copy link
Owner

ebruck commented May 21, 2017

Are you still seeing this? If so, can you try a small code change for me?

@eLBati
Copy link
Author

eLBati commented Jun 7, 2017

Hi @ebruck I am and I can

@ebruck
Copy link
Owner

ebruck commented Jun 10, 2017

@eLBati Can you make this change and see if the problem persists?

         cpu_load = int(CPUsage(interval=0.2).result)
-        image_idx = cpu_load / (100/(APP_NUM_IMAGES-1))
+        image_idx = cpu_load / (100.0/(APP_NUM_IMAGES-1))

@ebruck
Copy link
Owner

ebruck commented Jun 19, 2017

@eLBati Did it help?

@eLBati
Copy link
Author

eLBati commented Jun 20, 2017

@ebruck I made the change, but, launching from CLI:

/usr/share/indicator-doom-cpu$ ./indicator-doom-cpu 
./indicator-doom-cpu:25: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, GObject, GdkPixbuf
./indicator-doom-cpu:26: PyGIWarning: AppIndicator3 was imported without specifying a version first. Use gi.require_version('AppIndicator3', '0.1') before import to ensure that the right version gets loaded.
  from gi.repository import AppIndicator3 as AppIndicator
Traceback (most recent call last):
  File "./indicator-doom-cpu", line 132, in on_update_timer
    self.app_indicator.set_icon(APP_IMAGES[image_idx])
TypeError: list indices must be integers, not float

@ebruck
Copy link
Owner

ebruck commented Jun 20, 2017

@eLBati Sorry my mistake. Please patch like this:

         cpu_load = int(CPUsage(interval=0.2).result)
-        image_idx = cpu_load / (100/(APP_NUM_IMAGES-1))
+        image_idx = int(cpu_load / (100.0/(APP_NUM_IMAGES-1)))

@eLBati
Copy link
Author

eLBati commented Jun 21, 2017

Ok , applied. Let's see what happens in the next days

@eLBati
Copy link
Author

eLBati commented Jun 28, 2017

it happened again 😢

@ebruck
Copy link
Owner

ebruck commented Jun 28, 2017

Was this at system startup? I think here may be something weird going on when reading /proc/stat.
I'll look at putting in checks to prevent it from using a bad index.

@eLBati
Copy link
Author

eLBati commented Jun 29, 2017

@ebruck yes, it happens at startup. Then, if I close and open again the indicator, it works correctly.
Maybe we can add a debug log ? (if it's not already there)

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

2 participants