Python3 problems?

30 views
Skip to first unread message

daspostloch

unread,
Feb 3, 2011, 4:54:48 PM2/3/11
to reint...@googlegroups.com
Hi,

I am on Arch Linux and did a full system update
last weekend:

> python --version
Python 3.1.3
> pacman -Qi pygtk
Name : pygtk
Version : 2.22.0-3

After Reinteract failed, I pulled the
latest git version. But now I get:


> Traceback (most recent call last):
File "/home/user/bin/reinteract/bin/uninst.py", line 16, in <module>
script_path =
os.path.realpath(os.path.abspath(sys.argv[0])).decode("UTF-8")
AttributeError: 'str' object has no attribute 'decode'


Can you confirm that Reinteract is not compatible with Python3?
Is there an estimate of what would have to be done to make it?

Thanks for any enlightening -Paul


--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments

Robert Schroll

unread,
Feb 6, 2011, 11:16:47 AM2/6/11
to reint...@googlegroups.com
On 02/03/2011 04:54 PM, daspostloch wrote:
> Can you confirm that Reinteract is not compatible with Python3?
> Is there an estimate of what would have to be done to make it?

I can neither confirm nor deny such reports, since I haven't played with
Python3. But my assumption was that it would not work out-of-the-box.
One of the big changes in Python3 is text handling, and Reinteract
spends lots of its time handling text. The good news is the Reinteract
already uses Unicode throughout, so I suspect only syntax has to change,
not logic. You might want to check out the unicode-internals branch,
which was where the change to Unicode was done, to get an idea of the
scope. (But be aware that it's been 2 years since that was merged in,
so there've been some changes.)

Other than text, I'm sure there's a few places where the syntax changes
are important. But hopefully not too many, and hopefully 2to3 will
catch them for you.

Let us know how it goes,
Robert

daspostloch

unread,
Feb 6, 2011, 11:53:45 AM2/6/11
to reint...@googlegroups.com

Thanks, Robert. For an interim solution, would there be a way
to install two python versions alongside and tell ReInteract
to use a specific one? Sorry if this gets off-topic, but I'm
not at all familiar with python internals.

Owen Taylor

unread,
Feb 6, 2011, 1:57:13 PM2/6/11
to reint...@googlegroups.com
On Sun, Feb 6, 2011 at 11:53 AM, daspostloch <daspo...@googlemail.com> wrote:

Thanks, Robert. For an interim solution, would there be a way
to install two python versions alongside and tell ReInteract
to use a specific one? Sorry if this gets off-topic, but I'm
not at all familiar with python internals.

You  almost certainly already have Python 2 installed on your system. Arch Linux made the questionable decision to make /usr/bin/python python3 and /usr/bin/python2 python2.

So you just need to edit the Reinteract main script (/usr/bin/reinteract or whever) to do '/usr/bin/env python2' rather than '/usr/bin/env python'

daspostloch

unread,
Feb 6, 2011, 5:49:38 PM2/6/11
to reint...@googlegroups.com
> You almost certainly already have Python 2 installed on your system. Arch
> Linux made the questionable decision to make /usr/bin/python python3 and
> /usr/bin/python2 python2.
>
> So you just need to edit the Reinteract main script (/usr/bin/reinteract or
> whever) to do '/usr/bin/env python2' rather than '/usr/bin/env python'

Halleluja, questionable saved my day (and paper). Thanks Owen.

Owen Taylor

unread,
Feb 6, 2012, 8:42:20 PM2/6/12
to reint...@googlegroups.com
Just a note for posterity - I decided against making any changes to
reinteract for this. My reasoning is basically:

* /usr/bin/python as Python 3 is a basically just Arch Linux
* /usr/bin/python2 is not going to be in Debian/Ubuntu
(http://www.mail-archive.com/ubuntu-dev...@lists.ubuntu.com/msg12958.html)

I could add configure checks, but I don't expect users to be doing
configure/make/make install on their own and if someone is packaging
reinteract for Arch, they can fix up the #! line in packaging.

- Owen

> --
> You received this message because you are subscribed to the Google Groups
> "Reinteract" group.
> To post to this group, send email to reint...@googlegroups.com.
> To unsubscribe from this group, send email to
> reinteract+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/reinteract?hl=en.
>

Reply all
Reply to author
Forward
0 new messages