def init_profile_dir(self):
try:<EOL><INDENT>location = self.config.ProfileDir.location<EOL><DEDENT>except AttributeError:<EOL><INDENT>try:<EOL><INDENT>p = ProfileDir.find_profile_dir_by_name(self.ipython_dir, self.profile, self.config)<EOL><DEDENT>except ProfileDirError:<EOL><INDENT>if self.auto_create or self.profile=='<STR_LIT:default>':<EOL><INDENT>try:<EOL><INDENT>p = ProfileDir.create_profile_dir_by_name(self.ipython_dir, self.profile, self.config)<EOL><DEDENT>except ProfileDirError:<EOL><INDENT>self.log.fatal("<STR_LIT>"%self.profile)<EOL>self.exit(<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>self.log.info("<STR_LIT>"%p.location)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.log.fatal("<STR_LIT>"%self.profile)<EOL>self.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.log.info("<STR_LIT>"%p.location)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>p = ProfileDir.find_profile_dir(location, self.config)<EOL><DEDENT>except ProfileDirError:<EOL><INDENT>if self.auto_create:<EOL><INDENT>try:<EOL><INDENT>p = ProfileDir.create_profile_dir(location, self.config)<EOL><DEDENT>except ProfileDirError:<EOL><INDENT>self.log.fatal("<STR_LIT>"%location)<EOL>self.exit(<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>self.log.info("<STR_LIT>"%location)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.log.fatal("<STR_LIT>"%location)<EOL>self.exit(<NUM_LIT:1>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.log.info("<STR_LIT>"%location)<EOL><DEDENT><DEDENT>self.profile_dir = p<EOL>self.config_file_paths.append(p.location)<EOL>
initialize the profile dir