(location)
return os.path.abspath(os.path.expanduser(the_location))
Read/save a location from the configuration file.
Read/save a location from the configuration file.
Read / save a location from the configuration file .
def get_location(location):
    """
    Read/save a location from the configuration file.
    """
    locations_file = os.path.expanduser('~/.sympy/sympy-locations')
    config = ConfigParser.SafeConfigParser()
    config.read(locations_file)
    the_location = config.has_option("Locations", location) and config.get("Locations", location)
    if not the_location:
        the_location = raw_input("Where is the SymPy {location} directory? ".format(location=location))
        if not config.has_section("Locations"):
            config.add_section("Locations")
        config.set("Locations", location, the_location)
        save = raw_input("Save this to file [yes]? ")
        if save.lower().strip() in ['', 'y', 'yes']:
            print("saving to ", locations_file)
            with open(locations_file, 'w') as f:
                config.write(f)
    else:
        print("Reading {location} location from config".format(location=location))

    return os.path.abspath(os.path.expanduser(the_location))
def get_location ( location ) : locations_file = os . path . expanduser ( '~/.sympy/sympy-locations' ) config = ConfigParser . SafeConfigParser ( ) config . read ( locations_file ) the_location = config . has_option ( "Locations" , location ) and config . get ( "Locations" , location ) if not the_location : the_location = raw_input ( "Where is the SymPy {location} directory? " . format ( location = location ) ) if not config . has_section ( "Locations" ) : config . add_section ( "Locations" ) config . set ( "Locations" , location , the_location ) save = raw_input ( "Save this to file [yes]? " ) if save . lower ( ) . strip ( ) in [ '' , 'y' , 'yes' ] : print ( "saving to " , locations_file ) with open ( locations_file , 'w' ) as f : config . write ( f ) else : print ( "Reading {location} location from config" . format ( location = location ) ) return os . path . abspath ( os . path . expanduser ( the_location ) )