Houdini and python (general request) [solved]

   11434   9   0
User Avatar
Member
17 posts
Joined: July 2006
Offline
hi everyone,

I have a problem in compiling pyqt and wxpython to conform to the embedded python that comes with Houdini. The one with Houdini is compiled as an ansi version of the python interpreter.

A reply from pyqt mailing list a bit dissappointing. Quoting the reply directly;
“Building without Unicode support isn't supported. You'll just have to hack
at the code until it compiles.”

Is it possible to have a nightly build to include a unicode version of the embedded interpreter? That would save a lot of problems in getting some of the toolkits to work nicely with Houdini's python.

Thank you.

Best Regards,
Faizol
Edited by - Nov. 4, 2009 03:42:48
User Avatar
Member
7773 posts
Joined: July 2005
Offline
You don't mention which platform you are on. On OSX, Houdini uses the system version of python. On Linux, you can easily switch it to use the system version of python (2.5.X, UCS2 or UCS4) as well. It's only on Windows that has no system version of python.

PS. If you search for PyQT on the forum, several users have successfully used it with Houdini.
User Avatar
Member
17 posts
Joined: July 2006
Offline
Hi,

Thanx for replying.

Sorry that I didn't make make it clear regarding the platform. Regarding searching through the forum, actually I did that, but couldn't find anything on ansi compilation of wxpython and pyqt and nothing much on the right compilation options used.

Noted that in your reply, you mentioned for the toolkit to be compiled with either usc2 or ucs4 option. Is it possible to get some tips on the proper compilation flags with unicode ucs2 or ucs4?

Actually, I did successfully compiled the toolkit the first time using one of the two flags above but I had other problem after that, of which I asked about it here too;

link: http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=17313 [sidefx.com]

“Now every time the toolkit library is called, I'll encounter either PyUnicodeUCS2_AsLatin1String or PyUnicodeUCS2_FromEncodedObject error from the library. ”

Since it's obvious that I missed the right compile flags, would anyone kindly show the right options of compiling the toolkit here? I really appreciate it, and no doubt that will benefit other users as well.

Back to the problem, my platform is Fedora 11. As per compilation,
I compiled python 2.5.4 with –disable-unicode flag.

As per wxpython, the setup.py was run with UNICODE=0 flag to disable unicode. The compilation snippet is at this link (I tried to post the compilation output here but it seems that the forum cut off some of the outputs);

http://groups.google.com/group/wxpython-users/browse_thread/thread/11b45ff98a326aad# [groups.google.com]



I really appreciate any help.

Thank you.

best regards,
Faizol
User Avatar
Member
7773 posts
Joined: July 2005
Offline
Ok, so I think your problem is that on Fedora, python is built with ucs2 whereas on most other platforms (and Houdini) builds python with ucs4. So if you want to compile your own plugins for Houdini's python distribution, you should compile them for ucs4. I've never tried compiling pyqt or wxPython but I'm betting that “–disable-unicode” is the WRONG thing to do. I suggest you do some reading and figure out how to compile for ucs4.
User Avatar
Member
17 posts
Joined: July 2006
Offline
edward
Ok, so I think your problem is that on Fedora, python is built with ucs2 whereas on most other platforms (and Houdini) builds python with ucs4. So if you want to compile your own plugins for Houdini's python distribution, you should compile them for ucs4. I've never tried compiling pyqt or wxPython but I'm betting that “–disable-unicode” is the WRONG thing to do. I suggest you do some reading and figure out how to compile for ucs4.

Thanx. I got it solved. Actually, for Fedora 11 platform, the source code has to be compiled with unicode=ucs2 all the way from wx source to the site-packages installation. And the wx folder to be copied into houdini's python folder is the unicode version, not the ansi ones. I guess it would be helpful if some of the documentation materials can be updated or at least available online via wiki or something. I'm not sure if the wx-ansi version is meant only for windows platform?

Regarding other platforms, here is python code to test if the embedded interpreter has ucs2 or ucs4 so the source can be compiled accordingly. About other Linux distributions, I believe the embedded python is the same across all Linux distributions (kindly please correct me if I'm wrong here).

The code:

if (len(u'\U00010800') == 1):
print(“UCS4”)
else: #len is 2 in UCS2 builds
print (“UCS2”)

thanx again.

best regards,
Faizol
User Avatar
Member
7773 posts
Joined: July 2005
Offline
Embedded python can either be UCS2 or UCS4.
User Avatar
Member
17 posts
Joined: July 2006
Offline
edward
Embedded python can either be UCS2 or UCS4.

actually, I'm just curious, is there any documented materials for users to know which one they are using? Otherwise it'll be like shooting in the dark for users if we have to go through like this again.

The one that I installed on my Fedora is the debian version with gcc 4.3, not the redhat version. And the embedded python on that is a UCS2 version. So I guess that the ones on Linux distribution is standardized on UCS2?

As per wx toolkit, what about the wx-ansi requirement? Is it localized to only windows platform, or is it also should be the way for other platform as well? I spent a few days trying to figure out how to get wx-ansi working with Houdini on Linux platform but at the end it's wx-unicode that actually works. It would be helpful if we have a bit more information on that in the documentation.

thanx.

best regards,
Faizol
User Avatar
Member
7773 posts
Joined: July 2005
Offline
The situation is free to change depending on your OS, and if on Linux, your Linux distribution. Since you have a way to test for UCS2 or UCS4, you can always test which one Houdini is using by running your python code snippet in the Python Shell (inside Houdini).
User Avatar
Member
17 posts
Joined: July 2006
Offline
edward
The situation is free to change depending on your OS, and if on Linux, your Linux distribution. Since you have a way to test for UCS2 or UCS4, you can always test which one Houdini is using by running your python code snippet in the Python Shell (inside Houdini).

I think nobody would complain anything about that. That's just a nature in heterogeneous environment, which is I think a plus indeed.

The only hiccup (and this is not just on python in particular), is the lack of basic documentations to at least enable the user to have a proper starting point rather than just shooting in the dark from nowhere. Since the setup is already in a heterogeneous environment, having just a bit of a hint or something would be sufficient enough.

Anyways, I'll try to contribute any good findings back to the community, maybe through odwiki.

Thanx for helping.

cheers,
Faizol
User Avatar
Member
7773 posts
Joined: July 2005
Offline
Also feel free to add in additional comments to the help pages that you feel could use the extra info using Houdini's (internal) online help system.
  • Quick Links