Re: [lcm-users] running lcm on python3?

145 views
Skip to first unread message
Message has been deleted

Abe Bachrach

unread,
Jun 7, 2011, 10:32:30 AM6/7/11
to lcm-...@googlegroups.com
This has been discussed, but not started yet... Hopefully it will be implemented sometime in the coming months.

-=Abe

On Tue, Jun 7, 2011 at 10:20 AM, Simon Schulz <ssc...@techfak.uni-bielefeld.de> wrote:
Hi!

Are there any plans on porting lcm to python3?
I want to use it under blender 2.5 which is running python3 internally.
Or did i miss any compile/configure switch?

regards,
Simon

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


Simon Schulz

unread,
Jul 20, 2011, 6:58:06 AM7/20/11
to lcm-...@googlegroups.com
Hi!

For those who need to get lcm running on python3 i did
a port on my own. You can find a diff/patch here:
http://pastebin.com/mhPHCJ3Q

As mentioned in my first post i need to get it running under blender 2.5x
In order to do that you need to compile python 3.2 with wide unicode support
(you need ucs4 support in python3.2 -> ./configure --without-pymalloc --with-
wide-unicode)

In order to build lcm with/for python 3.2:
grab lcm-0.6.0
patch --dry-run -p1 -i lcm_py3.diff
export PYTHON="python3.2"; ./configure
and so on...

For my application it seems to work fine, but no guarantee that
it fails for other applications.
It should be possible to add if/else switches to get it to compile
under python2.

Simon

Simon Schulz

unread,
Oct 13, 2011, 6:23:45 AM10/13/11
to lcm-...@googlegroups.com
Hi!

Here is a patch for running lcm0.7.0 with python3:
http://pastebin.com/Rk9r3qge

maybe it is useful to soemone else ;)

install:


> In order to build lcm with/for python 3.2:

> grab lcm-0.7.0
> patch -p1 -i lcm_py3.diff
> export PYTHON="python3.2"; ./configure

Simon

Albert Huang

unread,
Oct 15, 2011, 1:08:24 AM10/15/11
to lcm-...@googlegroups.com
Hi Simon,

Thanks for the patch. If you can modify it so that it's backwards
compatible with Python2 (e.g., via the appropriate #if / #else
macros), then that will be easier for me to incorporate into trunk.

Albert

Simon Schulz

unread,
Jan 17, 2012, 5:59:09 AM1/17/12
to lcm-...@googlegroups.com
Hi!

We fixed a small bug in our python3 patch (in the string encode function).

The new patch can be found here:
http://pastebin.com/La71svis

Sorry we did not have time yet to produce a patch that would compile with
py2/py3 using macros etc... This is python3 only.

Regards,
Simon


--
Dipl. Inform. Simon Schulz
ssc...@techfak.uni-bielefeld.de

Exzellenzcluster Cognitive Interaction Technology
Universität Bielefeld
D-33501 Bielefeld
Germany

Thomas DeRensis

unread,
Dec 4, 2013, 12:49:33 AM12/4/13
to lcm-...@googlegroups.com, ssc...@techfak.uni-bielefeld.de
I know it has been a while, but if anyone is still interested I made a patch that should make lcm 1.0.0 work with Python 2 and 3. 

You can find it here. Testing is welcome!

Albert Huang

unread,
Dec 5, 2013, 12:46:29 AM12/5/13
to lcm-...@googlegroups.com, ssc...@techfak.uni-bielefeld.de
Hi Thomas,

This is great, thank you.  There are some issues with the patch for messages referencing other messages that are in a different package.  e.g.,

package abc;

struct value_t {
   int32_t data;
}

package def;
struct element_t {
  abc.value_t value;
}

In this case, the import statements generated by emit_python will be incorrect.

Albert



--
You received this message because you are subscribed to the Google Groups "Lightweight Communications and Marshalling" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lcm-users+...@googlegroups.com.

To post to this group, send email to lcm-...@googlegroups.com.

Thomas DeRensis

unread,
Dec 6, 2013, 12:45:58 AM12/6/13
to lcm-...@googlegroups.com, ssc...@techfak.uni-bielefeld.de
Ah, I didn't try that! 

After messing around with imports some more, I believe that I have fixed the issue. Now types in the same package use from . import type_t and types in another package use import otherpackage.type2_t. I also fixed a small bug where lcm-gen would keep adding duplicate types in __init__.py.

Updated version here.

Thomas DeRensis

unread,
Jan 7, 2014, 9:29:43 PM1/7/14
to lcm-...@googlegroups.com, ssc...@techfak.uni-bielefeld.de
I made an update to the python 2 to 3 patch, which also fixes an existing bug with python imports. Details are in issue 72 here.

-Tom

Matt Donahoe

unread,
Feb 26, 2014, 7:14:31 PM2/26/14
to lcm-...@googlegroups.com, ssc...@techfak.uni-bielefeld.de
Nice work on the patch! It got it working for python3, but I haven't been able to get lcm to build versions for both python3 and python2.7 at the same time on my system.

Does anyone else have that working? I assume I am just doing something wrong when building it.
Reply all
Reply to author
Forward
0 new messages