xrmx / bootchart

merge of bootchart-collector and pybootchartgui
GNU General Public License v2.0
236 stars 88 forks source link

pybootchartgui --annotate-file fails with "AttributeError: Trace instance has no attribute __getitem__" #41

Closed eugenmihailescu closed 12 years ago

eugenmihailescu commented 12 years ago

pybootchartgui --annotate=xfwm4 --annotate-file=myfile.txt fails with the error message:

Traceback (most recent call last): File "/usr/bin/pybootchartgui", line 23, in sys.exit(main()) File "/usr/lib64/python2.7/site-packages/pybootchartgui/main.py", line 142, in main for time in res[4]: AttributeError: Trace instance has no attribute 'getitem'

I have tried to take a look at the main.py source code and I found that:

res = parsing.Trace(writer, args, options) ... for time in res[4]: if time is not None:

output as ms

            print(time \* 10, file=f)
    else:
            print(file=f)

People in #python said: 21:44 [A] seems you're using [#] on something you can't use [#] on 21:45 [B] definitely looks like a bug in pybootchartgui to me, Trace doesn't even define a getitem method, you might have to prod the maintainer of it

My guess is that the line: for time in res[4]: if time is not None: should looks like: for time in res.times if time is not None:

Steps to reproduce:

pybootchartgui --annotate=xfwm4 --annotate-file=myfile No path given, trying /var/log/bootchart.tgz parsing '/var/log/bootchart.tgz' parsing 'header' parsing 'dmesg' parsing 'cmdline2.log' parsing 'paternity.log' parsing 'proc_cpuinfo.log' parsing 'proc_diskstats.log' parsing 'proc_meminfo.log' parsing 'proc_stat.log' parsing 'taskstats.log' merged 0 logger processes pruned 485 process, 0 exploders, 36 threads, and 0 runs merged 0 logger processes Traceback (most recent call last): File "/usr/bin/pybootchartgui", line 23, in sys.exit(main()) File "/usr/lib64/python2.7/site-packages/pybootchartgui/main.py", line 142, in main for time in res[4]: AttributeError: Trace instance has no attribute 'getitem'

-- System Information: Distro: Gentoo 4.7.1 p1.3, pie-0.5.3 Kernel: Linux 3.5.0 #2 SMP x86_64 Locale: LANG=en_US.UTF-8 Shell: /bin/bash Python: 2.7.3

xrmx commented 12 years ago

Thanks for reporting, should be fixed in git.