pootle_translationproject: Fix an exception during exception handling

directory is never defined outside the Try block.