Python List Comprehension

So it’s been a while since I updated anything on here. Part of that is because I don’t have the time anymore. The reason I don’t have the time is because I am now gainfully employed as a Technical Director at Reel FX. It’s pretty awesome and rewarding. Now all I do is write tools all day for the artists. :) Onwards. So Python is an amazingly awesome language. One of the reasons it’s so awesome is because you can do really hard things really easily in it. One of those things are list comprehensions. A list comprehension is basically a way of creating a new list based off of another list and a subset of qualities you’re looking for. Here’s an example:

# Input
my_list = [1, 2, 3, 4, 5]
new_list = [num for num in my_list if num > 3]

print new_list
>> [4, 5]

Continue reading Python List Comprehension

Redirect Maya’s output To stdout

This is gonna be a quick post to get this information out there, however, I wanted to let all of you know I’m not dead (if you follow me on Twitter or G+ you know that though). I’ve just been busy at my new job at Reel FX as a Tools TD and I’ve got some awesome stuff in the pipe on here that should be coming out in the next few weeks. Hopefully a redesign of the site will come about as well, but I wouldn’t hold my breath for that. :) With that said, here we go.

So about a week ago I asked if anyone knew how to redirect Maya’s script editor output to the shell – because I was having some scenes crash on me and wanted to pin down exactly which line in the .ma file was doing it. Continue reading Redirect Maya’s output To stdout

Maya and PyQt on OSX Snow Leopard and Hating It

Maya PyQt OSXSo this post has been sitting in my queue for over 2 months now. Why? Well, because it was a lot of trial and error and a lot of failure. I happen to like having clean installs and refuse to have redundancy when I can avoid it. So I thought that I’d do an install of PyQt for OSX to the default Python and symlink it to Maya that way I only have one install that I have to update when I need to update it – among other reasons. Unfortunately, Maya hates that idea. Loathes it even. The errors it spits out are ugly and are basically kill errors that make it so you can’t use PyQt either from bash or from Maya. Loads of fun, eh? ;) To top it off, even if you do get PyQt to work with Maya, there’s no point – in my opinion – in putting PyQt into your default Python install so you can run it from the CLI. Why? Because this bug from ’09 still hasn’t been resolved and you’ll get the following error: “Qt internal error: qt_menu.nib could not be loaded.” Note that the bug I reference is actually for when you choose no-framework, however, even without choosing no-framework as a compile option you’ll still get that error. PyQt on OSX is like trying to set environment variables permanently in XP with a .bat file (pre-SP2 and without using the registry). There is hope though and after a little read on why I’m doing this, we’ll get there. Continue reading Maya and PyQt on OSX Snow Leopard and Hating It