Comments (28)
Hey try to press CTRL + L while the app is running and then report.
from ptop.
CTRL+L clears the error, but I get no output. No resource usage, no processes, no updates at all.
from ptop.
Can you please post your system details and error log if any.
from ptop.
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.
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.
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.
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.
I will fix these errors ASAP.
from ptop.
Should work now, I have fixed a few things ! Can you please report ?
from ptop.
Same on Arch Linux, i3 with 4 cores, python3.4. Installed with pip.
from ptop.
@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.
Wasn't working for me before, pip --upgrade to 0.5 and it works now.
from ptop.
Yeah, actually I pushed to wrong branch :\ I just pushed , version 0.0.6 should work !
from ptop.
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.
press CTRL + L while its working.
from ptop.
that seems to work, but i seem to have to press CTRL+L a few times to get it nice
from ptop.
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.
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.
Well it seems there are IndexError
's at many places :/ Just fixed two of the them. Opening again !
from ptop.
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.
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.
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.
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.
from ptop.
@zamber I see you use python3, try using python2 for running ptop. Here : #9
from ptop.
Works fine now, thanks :). Issue closed.
from ptop.
@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.
I would change README.md to state:
Installation
pip install ptop
If python3 is your system default:
pip2.7 install ptop
from ptop.
@zamber Thanks !
from ptop.
Related Issues (20)
- Kill ptop properly HOT 4
- Killing chrome making ptop hung up
- The memory chart and process chart should be according to 100% in height HOT 1
- Feature Storming HOT 3
- New GUI can be drawn in terminal in case of terminal resizing HOT 2
- Optimize the sorting behavior
- Separate the keyboard shortcuts in some config file
- Killing a process making ptop exit abruptly HOT 3
- Python 3 compatability issue HOT 1
- Killing process when ptop starts HOT 1
- Restart process option not available as mentioned in #29.
- After killing terminal misbehaviour HOT 4
- Always an Update HOT 13
- Flickering, especially in byobu. HOT 1
- The Encoding Problem HOT 1
- Can't install ptop on CentOS 7 HOT 5
- Updater doesn't consistently work HOT 1
- ptop is the name of another program so won['t launch HOT 1
- No module named '_curses' HOT 2
- Proposing a PR to fix a few small typos
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ptop.