xrmx / bootchart

merge of bootchart-collector and pybootchartgui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python 3 incompatibility

mattia-b89 opened this issue · comments

make works but not pybootchart, there is a python 3 incompatibility
i'm on archlinux

Could you please paste the errors here?

pybootchartgui give me:

Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 20, in
from pybootchartgui.main import main
ImportError: No module named pybootchartgui.main

This means that the stuff is installed where your python can't find it. Does 'PY_LIBDIR=/usr/lib/python3.2 make' work?. Obviously change python3.2 to your python version.

If arch is already shipping python3 as default python the arch bootchart2 packager should handle this so please contact him.

no, same error....i've also opened a thread in our forum but nobody has reply

Could you please try with latest git? If it does not work you can try to pass PY_SITEDIR with the correct directory where your python stores packages which i don't know otherwise please wait the arch bootchart2 maintainer to update the package.

nothing works.....same error

i wait reply on forum because i think is only python related problem not bootchart....

i solved my issue:
i must edit PKGBUILD (installation script on archlinux) adding

sed -i -e 's|python2.6|python2.7|'
-e 's|python\b|python2|g' Makefile
make || return 1
make DESTDIR=${pkgdir} install || return 1
sed -i "s|#!/usr/bin/python$|#!/usr/bin/python2|" ${pkgdir}/usr/bin/pybootchartgui

so now it works !

So your default python is 3.x and you are forcing the script to use python2, which is 2.7.x., instead of python.

What does this gives you?
python -c "from distutils import sysconfig; print sysconfig.get_config_var('DESTLIB')"

I cannot see why latest git Makefile should not run out of the box on your platform. Are you sure it gives the very same error after make && make install without your sed expressions?

i get this:

File "<string>", line 1
from distutils import sysconfig; print sysconfig.get_config_var('DESTLIB')
                                                          ^
SyntaxError: invalid syntax

brown paper bug, fixed in latest git. Now we should start seeing python3 errors :)

yes, compiled latest git without any sed and now obtain:

Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 20, in <module>
from pybootchartgui.main import main
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 84
print s
          ^
SyntaxError: invalid syntax

It would take a few to fix all the issues and actually i don't think i have all pybootchartgui dependencies available on my system so for now you have to ship with your sed rules. Thanks for the time you have spent debugging the issue.

it's a pleasure to help you

so, when you complete to fix this issue, you say me, just write in this thread

hi!

So i've committed what brings me to a cairo import error to the 'python3' branch. Please checkout that branch and see if it is working fine or not for you.

when i compile, i get this error:

 Sorry: TabError: inconsistent use of tabs and spaces in indentation (draw.py, line   170)Sorry: TabError: inconsistent use of tabs and spaces in indentation (gui.py, line 39)Sorry: TabError: inconsistent use of tabs and spaces in indentation (draw.py, line 170)Sorry: TabError: inconsistent use of tabs and spaces in indentation (gui.py, line 39)

despite that i can install bootchart and if i launch pybootchart, i get:

Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 20, in <module>
from pybootchartgui.main import main
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 26, in <module>
from . import batch
File "/usr/lib/python3.1/site-packages/pybootchartgui/batch.py", line 16, in <module>
import cairo
ImportError: No module named cairo

You do not have pycairo for python3 installed.

yes, and it isn't in the our repo, i'll wait it ....

i've installed python-cairo, now i get the same error compiling but when i launch pybootchart i get this:

Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 20, in <module>
from pybootchartgui.main import main
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 84
print s
      ^
SyntaxError: invalid syntax

It looks you have not installed the python3 branch :)

how i can clone get python3 branch and not the master ?

i append "-b python3" in git clone command and i think i succesful. now i get the same error compiling but when i launch pybootchart, i get:

Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 20, in <module>
from pybootchartgui.main import main
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 26, in <module>
from . import batch
File "/usr/lib/python3.1/site-packages/pybootchartgui/batch.py", line 17, in <module>
from . import draw
File "/usr/lib/python3.1/site-packages/pybootchartgui/draw.py", line 170
    if label_w + 10 > w:
                       ^
TabError: inconsistent use of tabs and spaces in indentation

Fixed taberror issues in draw.py in python3 branch.

now, when compile:

Sorry: TabError: inconsistent use of tabs and spaces in indentation (gui.py, line 39)Sorry: TabError: inconsistent use of tabs and spaces in indentation (gui.py, line 39)

and launching pybootchart (without bootchart.tgz, i haven't boot using my bootchart entry in grub....):

No path given, trying /var/log/bootchart.tgz
parsing '/var/log/bootchart.tgz'
parsing 'header'
Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 23, in <module>
sys.exit(main())
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 118, in main
res = parsing.Trace(writer, args, options)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 45, in __init__
parse_paths (writer, self, paths)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 586, in parse_paths
state = _do_parse(writer, state, name, tf.extractfile(name))
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 533, in _do_parse
state.headers = _parse_headers(file)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 150, in _parse_headers
return reduce(parse, file.read().split('\n'), (defaultdict(str),''))[0]
NameError: global name 'reduce' is not defined

pushed some more fixes, please retest.

now without any issues when compile but when i launch pybootchartgui i get (still without a bootchart.tgz .):

No path given, trying /var/log/bootchart.tgz
parsing '/var/log/bootchart.tgz'
parsing 'header'
Traceback (most recent call last):
File "/usr/bin/pybootchartgui", line 23, in <module>
sys.exit(main())
File "/usr/lib/python3.1/site-packages/pybootchartgui/main.py", line 118, in main
res = parsing.Trace(writer, args, options)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 46, in __init__
parse_paths (writer, self, paths)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 587, in parse_paths
state = _do_parse(writer, state, name, tf.extractfile(name))
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 534, in _do_parse
state.headers = _parse_headers(file)
File "/usr/lib/python3.1/site-packages/pybootchartgui/parsing.py", line 151, in _parse_headers
return reduce(parse, file.read().split('\n'), (defaultdict(str),''))[0]
TypeError: Type str doesn't support the buffer API

I cannot reproduce your error but i've pushed another fix for the same function, could you please try again and if it does not work send me /var/log/bootchart.tgz file by email? You can find my email address in the git history.

sent the email