python 3 incompatibility #16

Closed
mattia-b89 opened this Issue Jan 3, 2011 · 27 comments

Projects

None yet

2 participants

@mattia-b89

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

@xrmx
Owner
xrmx commented Jan 3, 2011

Could you please paste the errors here?

@mattia-b89

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

@xrmx
Owner
xrmx commented Jan 3, 2011

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.

@mattia-b89

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

@xrmx
Owner
xrmx commented Jan 3, 2011

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.

@mattia-b89

nothing works.....same error

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

@mattia-b89

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 !

@xrmx
Owner
xrmx commented Jan 6, 2011

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?

@mattia-b89

i get this:

File "<string>", line 1
from distutils import sysconfig; print sysconfig.get_config_var('DESTLIB')
                                                          ^
SyntaxError: invalid syntax
@xrmx
Owner
xrmx commented Jan 6, 2011

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

@mattia-b89

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
@xrmx
Owner
xrmx commented Jan 6, 2011

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.

@mattia-b89

it's a pleasure to help you

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

hi!

@xrmx
Owner
xrmx commented Jan 16, 2011

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.

@mattia-b89

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
@xrmx
Owner
xrmx commented Jan 17, 2011

You do not have pycairo for python3 installed.

@mattia-b89

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

@mattia-b89

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
@xrmx
Owner
xrmx commented Jan 19, 2011

It looks you have not installed the python3 branch :)

@mattia-b89

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

@mattia-b89

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
@xrmx
Owner
xrmx commented Jan 19, 2011

Fixed taberror issues in draw.py in python3 branch.

@mattia-b89

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
@xrmx
Owner
xrmx commented Jan 19, 2011

pushed some more fixes, please retest.

@mattia-b89

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
@xrmx
Owner
xrmx commented Jan 19, 2011

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.

@mattia-b89

sent the email

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment