some Python & SSH remote machine coolness

And now for a bit of self taught nerdy goodness…

I just managed to get something kind of cool working.

We have a cool tool in the pipeline, but in the meantime my hacked together python efforts will have to do! 😉

A few months ago I created a python script for building ‘job’ directories – for new jobs that came into the building – a script that runs in a shell.

I then learnt about wxpython and turned the script into a GUI app.

This was cool to run on my machine, but I needed a way for it to be used by other artists / producers.

We got an xServe and some disk storage so I put the script onto the xServe. I was able to log in via VNC and run the script to create the job directories that everyone could access. This gave us all a place to put files in a structured manner and not let things get too messed up (thanks to file permissions).

But the problem was that for me to execute the script, I’d have to VNC or SSH into the server. I didn’t mind doing it, but it was not so useful when I wasn’t around.

So back to this ‘new job’ script….

I just worked out how to setup a producer’s mac to be able to “remotely execute the python ‘new job’ script on our xServe” using SSH and python.

All a producer has to do is type into Terminal:


and it all starts up. The producer is asked the ‘name of the job’ and ‘the number of shots’ and the script goes ahead and builds all the directories.

How I did it

Getting into the xServe.
I realised that I would not be able to do too much to the file structure of the xServe’s file system if I was to simply mount it on a Desktop – due to permissions etc… and I also didn’t want ‘the user’ to have to mount anything manually. It needed to brainless. SSH seemed the best way.

I found out pretty quickly that there wasn’t an easy way to get out of entering the ‘admin password’ for the xServe to remotely execute the script (you have to enter a password when you ssh into another machine).

I didn’t want to give away our admin password for the xserve. So I read up on SSH and discovered SSH-Key’s.
A cool way to authenticate your machine to the remote machine without having to enter the ‘login password’ for the remote user. Instead you give the SSH connection a ‘passphrase’. Initially you have to login to the remote machine with the remote password, but after that it’s all ‘ about ‘enter your passphrase for key’.

To set up the RSA key for your local machine I followed this easy to read tutorial from IBM.

Basically you need to generate a public key and add that to the list of ‘known computers’ on the remote machine.

To generate the public key (according to the IBM article) run this command in a shell:

$ ssh-keygen -t rsa

and follow the prompts.

You can choose to not have a passphrase, but that seemed a little too much of a security risk for our setup.
Next I got a bit confused, the command spat out 2 files into a ‘.ssh’ directory in your home folder:


These are the default names and location if u DON’T enter a name for the key.

To get the public key (the .pub file) into the list of known machines on the xServe I mounted the xServe’s Admin’s home folder on the local machine.

I got into the .ssh directory in the home folder of the xserve, and went looking for the file:


but couldn’t see it.

So i created a file called ‘authorized_keys’ using the following command:

touch authorized_keys

Then to add the public key I ran a ‘cat’ command to append the public key file to the ‘authorized_keys’ file on the server.

It worked! I was able to login the the xServe using the passphrase. Shweet!

I found this post on an apple forum also very helpful.

Executing the script

On the remote machine / xServe is where the python script lives – in a folder called ‘scripts’ in the home folder.
To run this script in a shell on the xServe I would type:

python /Path/to/the/script/

So I figured from the local machine the command to execute using ssh would be:

ssh admin@ourserver.local python /Path/to/the/script/

And that did work.

But that was wayyyyyy too long for or our Producer to have to type up.

So I made bash alias in the bash_profile:

alias newjob ssh admin@ourserver.local python /Path/to/the/script/

i tried the alias, and it connected, but it didn’t seem the script was doing anything. But it was. I couldnt see the interactive text prompting me to enter a ‘jobname’ or ‘amount of shots’, but it WAS asking for it.

Why couldn’t I see the text? I was stumped. Why wasn’t the shell showing me the feedback from the xServe?

I read the man pages of SSH and found out a bunch of options you can pass the ssh command. Somehow I came across this:

-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

As soon as I put that into the command it all worked!

ssh -t admin@ourserver.local python /Path/to/the/script/

The last thing I did to make this even easier was to create a ‘.command’ file in the OSX Finder, that can just be double clicked and it will open and run the above command.

FCS2, PSD, Motion, AJA kona 10-bit YUV and Colorista

Recently I have noticed a few bugs with our FCS2 system.

We are using Final Cut Studio 2 with an AJA 10bit Kona LHe card equipped MacPro 2×3GHz Quad running OSX 10.4.9.

1. Importing PSD into FCP

Until about a month ago I was able to import PSD files into FCP as a layered sequence. Now I don’t seem to be able to get that to happen – the file only comes in a flattened file. Not sure why

My workaround for now is to open the PSD file in Motion as a layered comp. I think this is actually a better way to lay up gfx anyway – Motion is much faster for controlling the layers. Props to Dr Gormley for the tip!

2. Problems playing out Motion projects in FCP

For me one of the coolest things of working with Motion in FCP is that you can jump back and forth between the two and the embedded Motion project will update.

But, now when I render the Motion clip and put it out to a VTR, it plays out bizarre – sometimes with a heavy PINK cast to it.

To workaround this I changed the FCP sequence setting from ‘Render 10-bit Material in high-precision YUV’ to ‘Render in 8-bit YUV’. This seems to allow me to get SOMETHING to tape that is not screwed up – but means we are not going to tape in 10bit.

The other way around this is to simply render a QuickTime out of Motion – but I really like the flexibility of the embedded comps in FCP – good for working with clients.

3. Magic Bullet Colorista – no likey 10-bit sequences either

The Colorista plugin is awesome and I use it quite a lot. But it seems to be another hater of the 10bit YUV render setting in FCP. Sometimes I render the clips with Colorista on them, and it will produce some random artifacting to the clip, sometimes random bright noise in some areas.

Workaround: Changing the fcp sequences’ render settings to 8bit fixes this

So I am going to suss this out and find some solutions/explanations – I will blog back about this as I go.


life is good with rsync.

I have been playing around with a python script using rsync to create an easy way for syncing new material from our server to local machines (it can be a pain in the ass to navigate folders looking for the new stuff) – keeping the folder structure etc… – and most importantly not destroying anything.

I’d never really understood how to use it – thinking it was only for local to remote transfers – but it works on anything. Brilliant!

RSYNC rocks!

Python script to get all maximum values in an image sequence

Yesterday i fudged together a python script to use Shake and create an image that is the maximum values of that sequence.

The output of the python script is a Shake script that contains as many FileIns as there are images in the sequence – each one slipped one frame more than the previous. Does that make any sense?

Each image is plugged into a Max layer node and then that is plugged into the next Max layer node etc….

So depending on the length of your sequence the Shake script can be enormous!

Python is awesome.


Here is the script:
shake max python script (1219 downloads)

Sharepoint – getting windows to see more on my Mac

Today I had to mount an OSX Volume (other than the startup disk) on a Windoze XP machine.

I had Window’s Sharing enabled on the OSX machine, but I couldn’t get the Windoze box to see the extra Volumes the OSX machine had.

Luckily I founds this cool piece of Donation-ware called Sharepoints

SharePoints is an application or a preference pane that makes it easy to add and delete share points like in the old Finder. In Mac OS X, by default, you are limited to sharing only what is in your public folder in your home directory. This program makes it easy to share any folder.
In addition SharePoints also brings back users and groups management to Mac OS X as well as easy configuration of AppleFileServer (AFS) and Samba (SMB) Server properties.