Skip to content

Setting configuration values from the dictionary returned by astropy.config.get_config fails #1567

Closed

Description

@mwcraig

If I try setting a configuration value at run time like this:

from astropy.config import get_config
items = get_config('astropy.utils.data')
items['dataurl'].set('http://astropydata.mywebsite.com')

it fails with:

ERROR: AttributeError: 'str' object has no attribute 'set' [IPython.core.interactiveshell]

in both 0.2.4 and 0.3.dev5708.

Setting the configuration using the other method described in the documentation works:

from astropy.utils.data import DATAURL
DATAURL.set('http://astropydata.mywebsite.com')

Activity

  1. embray commented on Oct 14, 2013

    @embray
    Member

    Thanks for the report. But I don't think that's a bug. In the former case it should just be items['dataurl'] = 'http://astropydata.mywebsite.com' because there you're just modifying the configuration dict directly.

    Is the former method something you got from the documentation? Because if so that would be a documentation bug.

  2. mwcraig commented on Oct 14, 2013

    @mwcraig
    MemberAuthor

    It is from the documentation--I'll can open a pull request later today to
    fix it if you would like.

    On Monday, October 14, 2013, Erik Bray wrote:

    Thanks for the report. But I don't think that's a bug. In the former case
    it should just be items['dataurl'] = 'http://astropydata.mywebsite.com'because there you're just modifying the configuration dict directly.

    Is the former method something you got from the documentation? Because if
    so that would be a documentation bug.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/1567#issuecomment-26274375
    .

  3. eteq commented on Oct 18, 2013

    @eteq
    Member

    Fixed in #1582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions