Giter VIP home page Giter VIP logo

Comments (28)

darxtrix avatar darxtrix commented on May 30, 2024

Hey try to press CTRL + L while the app is running and then report.

from ptop.

dhagrow avatar dhagrow commented on May 30, 2024

CTRL+L clears the error, but I get no output. No resource usage, no processes, no updates at all.

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

Can you please post your system details and error log if any.

from ptop.

dhagrow avatar dhagrow commented on May 30, 2024

The traceback is in the original screenshot. Based on that it looks like the error may be related to the number of CPU cores. I have 8. This is all on Ubuntu 12.04 x64.

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

okay gotcha, there should be something here https://github.com/black-perl/ptop/blob/master/ptop/plugins/cpu_sensor.py#L19 .

Well, thanks for reporting. I will try to fix it ASAP.

from ptop.

aaronscientiae avatar aaronscientiae commented on May 30, 2024

Getting the same or similar on my fedora 22 x64 box. Below is output of stderr:
Traceback (most recent call last):
File "/usr/bin/ptop", line 9, in
load_entry_point('ptop==0.0.4', 'console_scripts', 'ptop')()
File "/usr/lib/python2.7/site-packages/ptop/main.py", line 45, in main
app.run()
File "/usr/lib/python2.7/site-packages/npyscreen/apNPSApplication.py", line 30, in run
return npyssafewrapper.wrapper(self.__remove_argument_call_main)
File "/usr/lib/python2.7/site-packages/npyscreen/npyssafewrapper.py", line 41, in wrapper
wrapper_no_fork(call_function)
File "/usr/lib/python2.7/site-packages/npyscreen/npyssafewrapper.py", line 89, in wrapper_no_fork
curses.cbreak()
_curses.error: cbreak() returned ERR
~

Below is output when hitting Ctrl-L a few times, then Ctrl-K

Traceback (most recent call last):
File "/usr/bin/ptop", line 9, in
load_entry_point('ptop==0.0.4', 'console_scripts', 'ptop')()
File "/usr/lib/python2.7/site-packages/ptop/main.py", line 45, in main
app.run()
File "/usr/lib/python2.7/site-packages/npyscreen/apNPSApplication.py", line 30, in run
return npyssafewrapper.wrapper(self.remove_argument_call_main)
File "/usr/lib/python2.7/site-packages/npyscreen/npyssafewrapper.py", line 41, in wrapper
wrapper_no_fork(call_function)
File "/usr/lib/python2.7/site-packages/npyscreen/npyssafewrapper.py", line 97, in wrapper_no_fork
return_code = call_function(_SCREEN)
File "/usr/lib/python2.7/site-packages/npyscreen/apNPSApplication.py", line 25, in __remove_argument_call_main
return self.main()
File "/usr/lib/python2.7/site-packages/ptop/interfaces/GUI.py", line 309, in main
self.window.edit()
File "/usr/lib/python2.7/site-packages/npyscreen/fm_form_edit_loop.py", line 47, in edit
self.edit_loop()
File "/usr/lib/python2.7/site-packages/npyscreen/fm_form_edit_loop.py", line 38, in edit_loop
self._widgets
[self.editw].edit()
File "/usr/lib/python2.7/site-packages/npyscreen/wgboxwidget.py", line 149, in edit
self.entry_widget.edit()
File "/usr/lib/python2.7/site-packages/npyscreen/wgmultiline.py", line 581, in edit
self.get_and_use_key_press()
File "/usr/lib/python2.7/site-packages/npyscreen/wgwidget.py", line 599, in get_and_use_key_press
self.handle_input(ch)
File "/usr/lib/python2.7/site-packages/npyscreen/wgwidget.py", line 80, in handle_input
self.handlers_unctrl_input
File "/usr/lib/python2.7/site-packages/ptop/interfaces/GUI.py", line 39, in kill_process
pid = self.values[self.cursor_line].split()[1]
IndexError: list index out of range

from ptop.

colindickson avatar colindickson commented on May 30, 2024

even with the latest fixes, i'm still getting index errors on start up.

getting an IndexError at line 133 in ptop/interfaces/GUI.py

    for i in range(self.CHART_LENGTH):
        if i >= 2:
            chart_array[i-2] = chart_array[i]

(quad-core ubuntu 14.10, python 2.7.10)

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

I will fix these errors ASAP.

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

Should work now, I have fixed a few things ! Can you please report ?

from ptop.

zamber avatar zamber commented on May 30, 2024

Same on Arch Linux, i3 with 4 cores, python3.4. Installed with pip.

from ptop.

colindickson avatar colindickson commented on May 30, 2024

@Black-Perl still the same. in fact, i don't see any commits since my last pull. are you sure you pushed the fix?

screenshot https://i.imgur.com/450DHig.png

from ptop.

danlamanna avatar danlamanna commented on May 30, 2024

Wasn't working for me before, pip --upgrade to 0.5 and it works now.

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

Yeah, actually I pushed to wrong branch :\ I just pushed , version 0.0.6 should work !

from ptop.

colindickson avatar colindickson commented on May 30, 2024

so, the IndexError might be gone... i'm not sure. i get this kind of crazy output now:

https://i.imgur.com/PMyybLM.png

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

press CTRL + L while its working.

from ptop.

colindickson avatar colindickson commented on May 30, 2024

that seems to work, but i seem to have to press CTRL+L a few times to get it nice

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

Yeah some weird issue with the dependency npyscreen, don't know why ? It is making a hell of a life to make it responsive too !

  • Still a few issues with charts on different screens, lets hope I can make them work.
  • Would be nicer if a search box can be there to filter running process, but with npyscreen it's hell tough by keeping things responsive.

Well, thanks man for testing it !

from ptop.

zamber avatar zamber commented on May 30, 2024

0.0.6 still does not work for me. Going to sleep now. Will respond in +-9h.

zamber@xwing ~ % ptop 
Traceback (most recent call last):
  File "/usr/bin/ptop", line 9, in <module>
    load_entry_point('ptop==0.0.6', 'console_scripts', 'ptop')()
  File "/usr/lib/python3.4/site-packages/ptop/main.py", line 48, in main
    app.run()
  File "/usr/lib/python3.4/site-packages/npyscreen/apNPSApplication.py", line 30, in run
    return npyssafewrapper.wrapper(self.__remove_argument_call_main)
  File "/usr/lib/python3.4/site-packages/npyscreen/npyssafewrapper.py", line 41, in wrapper
    wrapper_no_fork(call_function)
  File "/usr/lib/python3.4/site-packages/npyscreen/npyssafewrapper.py", line 97, in wrapper_no_fork
    return_code = call_function(_SCREEN)    
  File "/usr/lib/python3.4/site-packages/npyscreen/apNPSApplication.py", line 25, in __remove_argument_call_main
    return self.main()
  File "/usr/lib/python3.4/site-packages/ptop/interfaces/GUI.py", line 313, in main
    self.window.edit()
  File "/usr/lib/python3.4/site-packages/npyscreen/fm_form_edit_loop.py", line 47, in edit
    self.edit_loop()
  File "/usr/lib/python3.4/site-packages/npyscreen/fm_form_edit_loop.py", line 38, in edit_loop
    self._widgets__[self.editw].edit()
  File "/usr/lib/python3.4/site-packages/npyscreen/wgboxwidget.py", line 149, in edit
    self.entry_widget.edit()
  File "/usr/lib/python3.4/site-packages/npyscreen/wgmultiline.py", line 581, in edit
    self.get_and_use_key_press()
  File "/usr/lib/python3.4/site-packages/npyscreen/wgwidget.py", line 599, in get_and_use_key_press
    self.handle_input(ch)
  File "/usr/lib/python3.4/site-packages/npyscreen/wgwidget.py", line 80, in handle_input
    self.handlers[_unctrl_input](_input)
  File "/usr/lib/python3.4/site-packages/ptop/interfaces/GUI.py", line 39, in kill_process
    pid = self.values[self.cursor_line].split()[1]
IndexError: list index out of range

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

Well it seems there are IndexError's at many places :/ Just fixed two of the them. Opening again !

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

Can you give me the logs of ~/.ptop.log by running it again, particularly I am interested in the terminal screen size.

Thanks !

from ptop.

anongit avatar anongit commented on May 30, 2024

My bet is that some process has finished and self.values got updated, but not self.cursor_line.

    def kill_process(self,*args,**kwargs):
        pid = self.values[self.cursor_line].split()[1]  # don't do this
        # it should look somewhat like this:
        process = self.values[self.cursor_line]
        # i.e. you should have a proper datatype for this
        target = psutil.Process(process.pid)
        target.terminate()

I don't actually like this process = self.values[self.cursor_line] either, if you don't sync stuff properly, you can kill the wrong process.

Another possiblity is that somehow you have a value with an empty or incorrect string, but I doubt that if this is how you populate those self.values:

temp_list.append("{0: <30} {1: >5}{5}{2: <10}{5}{3: <8}{5}{4: <4} % \
    ".format( (proc['name'][:25] + '...') if len(proc['name']) > 25 else proc['name'],
                    proc['id'],
                    proc['user'],
                    proc['time'],
                    proc['memory'],
                    " "*int(5*self.X_SCALING_FACTOR))
      )

Also I'd prettify this code a bit:

# to keep things pre computed
temp_list = []
line = "{pname: <30} {id: >5}{hs}{user: <10}{hs}{time: <8}{hs}{memory: <4} % "
spacer = " " * int(5 * self.X_SCALING_FACTOR)
for proc in sorted_table:
    if proc['user'] != system_info['user']:
       continue

    name = (proc['name'][:25] + '...') if len(proc['name']) > 25 else proc['name']
    temp_list.append(line.format(pname=name, hs=spacer, **proc))

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

Thanks @anongit for detailed explanation of things ! Will check this if works or not and thanks for the formatted code, I will try to format the code in the repo too. It looks more nice and better to read !

from ptop.

zamber avatar zamber commented on May 30, 2024

After applying @anongit's suggestion:

self.cursor_line = -1
self.values = []

~/.ptop.log:

12:17:00,466 ptop.statistics INFO Started thread job for the sensor <ptop.plugins.cpu_sensor.CPUSensor object at 0x7feea5e00ba8>
12:17:00,467 ptop.statistics INFO Started thread job for the sensor <ptop.plugins.disk_sensor.DiskSensor object at 0x7feea5e00c50>
12:17:00,467 ptop.statistics INFO Started thread job for the sensor <ptop.plugins.memory_sensor.MemorySensor object at 0x7feea5e07240>
12:17:00,467 ptop.statistics INFO Started thread job for the sensor <ptop.plugins.process_sensor.ProcessSensor object at 0x7feea5e073c8>
12:17:00,468 ptop.statistics INFO Started thread job for the sensor <ptop.plugins.system_sensor.SystemSensor object at 0x7feea5e07588>
12:17:00,468 ptop.main INFO Statistics generating started
12:17:00,468 ptop.main INFO Starting the GUI application
12:17:00,469 ptop.GUI INFO (40, 151)
12:17:01,477 ptop.GUI INFO Started GUI update thread

Terminal size and type does not make any difference, still fails with the same error.

2015-07-08-123125_1366x768_scrot

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

@zamber I see you use python3, try using python2 for running ptop. Here : #9

from ptop.

zamber avatar zamber commented on May 30, 2024

Works fine now, thanks :). Issue closed.

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

@zamber Can you please tell what was the workaround you used to resolve it and if there is a bug or something, you can send in a pull :-)

from ptop.

zamber avatar zamber commented on May 30, 2024

Same as #8 and #9.

I would change README.md to state:

Installation

pip install ptop

If python3 is your system default:

pip2.7 install ptop

from ptop.

darxtrix avatar darxtrix commented on May 30, 2024

@zamber Thanks !

from ptop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.