James Tauber

journeyman of some

blog > 2005 > 05 >

James Tauber's Blog 2005/05/24

Almost Ready for Leonardo 0.6 Release

Tonight I finished the remaining items I wanted to get done for the release of Leonardo 0.6.

That puts me ahead as I wasn't planning on a release candidate until the weekend and I should get it out tomorrow.

Will give me more time the rest of the week to work on editing the Atlanta reality show pilot.

by jtauber : Created on May 24, 2005 : Last modified May 24, 2005 : Categories leonardo : 1 comment (permalink)

Checkpoint at 31.5

Just went past the half-way mark between being 31 and 32.

On my 31st birthday, I posted a list of goals for my 32nd year. Let's see how I'm going:

  • screening Alibi at festivals — DONE!
  • releasing the first Nelson James EP — made good progress before my US trip but looking doubtful as I will have spent over 80% of the first half of 2005 on the opposite side of the world from Nelson.
  • successfully running a 5K race — terrible progress! Haven't been training at all since I've been in US.
  • sitting music theory exam (and maybe practical too) — haven't done anything theory-wise although piano practice has been going well since I got my keyboard here in US.
  • getting back to Go — made a conscious decision a few months ago I was going to have to let this one slide.
  • completing Pimsleur Italian I, II and III — finished I, haven't made good progress on II yet.

Overall, not looking good but having spent months away from home, I have an excuse for some of them.

What am I most pleased with my progress on? Definitely Leonardo!

by jtauber : Created on May 24, 2005 : Last modified May 24, 2005 : Categories personal : 1 comment (permalink)

Testing For Directories Outside the Tree

In Leonardo, I have a case where I am concatenating a fixed directory x and a relative path y.

I want to avoid the result being outside the directory tree rooted by x.

Any ideas?

Is

root = os.path.abspath(x)
path = os.path.abspath(os.path.join(x, y))
assert path.startswith(root)

a reasonable approach?

Actually, I should clarify: y isn't a relative path as such. y can be '/' which should taken to mean x. So perhaps what I want is:

root = os.path.abspath(x)
path = os.path.abspath(os.path.normpath(x + os.sep + y))
assert path.startswith(root)

I ruled out

assert os.path.normpath(x + os.sep + y).startswith(x)

For the case where 'x' is itself relative.

by jtauber : Created on May 24, 2005 : Last modified May 24, 2005 : Categories python : 2 comments (permalink)