moving pwd import into the try...except to avoid importerrors on windows.