Skip to content

Fix bug in failed configuration file generation warning #950

Closed

Description

@astrofrog

@mdboom - commit fcc2d63 introduced an issue with Python 3 when the warning is emitted:

AttributeError: 'str' object has no attribute 'decode'

Activity

  1. ghost assigned on Apr 8, 2013
  2. astrofrog commented on Apr 8, 2013

    @astrofrog
    MemberAuthor

    If I remove the decode for Python 3, I still get an error when generating the configuration file for an affiliated package. Running

    python setup.py install --user
    

    in the affiliated package template and with Python 3.2 gives:

    generating default packagename.cfg file
    Generation of default configuration item failed! Stdout and stderr are shown below.
    Stdout:
    
    Stderr:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Volumes/Raptor/Library/Python/3.2/lib/python/site-packages/astropy-0.3.dev3723-py3.2-macosx-10.8-x86_64.egg/astropy/config/configuration.py", line 627, in generate_all_config_items
        package = get_loader(pkgornm).load_module(pkgornm)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/pkgutil.py", line 243, in load_module
        mod = imp.load_module(fullname, self.file, self.filename, self.etc)
      File "/Volumes/Raptor/Dropbox/Code/development/Astropy/package-template/build/lib.macosx-10.8-x86_64-3.2/packagename/__init__.py", line 116, in <module>
        config.configuration.update_default_config(__package__, config_dir)
      File "/Volumes/Raptor/Library/Python/3.2/lib/python/site-packages/astropy-0.3.dev3723-py3.2-macosx-10.8-x86_64.egg/astropy/config/configuration.py", line 688, in update_default_config
        if os.path.exists(cfgfn):
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/genericpath.py", line 18, in exists
        os.stat(path)
    TypeError: Can't convert 'NoneType' object to str implicitly
    

    @eteq @iguananaut @mdboom - any ideas where this is coming from?

    This is actually a big issue, because combined with the decode issue, it means that affiliated packages cannot be installed with Astropy 0.2.1! So 0.2.2 may have to come sooner rather than later once this is fixed.

  3. astrofrog commented on Apr 8, 2013

    @astrofrog
    MemberAuthor

    The last error message affects Python 2.x and Python 3.x.

  4. embray commented on Apr 8, 2013

    @embray
    Member

    I'm not sure, but I think this wouldn't be a problem if the template package were using _ASTROPY_SETUP_ instead of _PACKAGE_SETUP_. I see no reason not to use the former in affiliated packages too.

  5. embray commented on Apr 8, 2013

    @embray
    Member

    #867 might also be relevant here.

  6. astrofrog commented on Apr 8, 2013

    @astrofrog
    MemberAuthor

    @iguananaut - ah, I was wondering about that. I think that in that case I should change the package template to use _ASTROPY_SETUP_ - I didn't realize it would have implications at the time.

  7. mdboom commented on Apr 8, 2013

    @mdboom
    Contributor

    As for the original bug -- sorry, I had forgotten that setup_helpers.py is one of the files that doesn't get 2to3-d. I have a fix in #952. That doesn't address the affiliated package issue, though.

  8. eteq commented on Apr 15, 2013

    @eteq
    Member

    So should we close this now, @astrofrog and @mdboom? Looks to me like #952 was supposed to fix it, right?

  9. mdboom commented on Apr 15, 2013

    @mdboom
    Contributor

    I think so. @astrofrog: as the OP, feel free to reopen if you discover it isn't resolved.

  10. astrofrog commented on Apr 15, 2013

    @astrofrog
    MemberAuthor

    @mdboom - ok, thanks! I think this all works for me now.

  11. added a commit that references this issue on Aug 10, 2015
  12. added a commit that references this issue on Nov 5, 2015
  13. MjdMahasneh commented on Sep 21, 2018

    @MjdMahasneh

    @embray Hello! am having the same issue and i have seen your comment about using ASTROPY_SETUP instead of PACKAGE_SETUP however i dont know how to change the template package settings to start using ASTROPY_SETUP. please advice.

  14. pllim commented on Sep 21, 2018

    @pllim
    Member

    @MjdMahasneh , if you have problem with the package template, please open an issue at https://github.com/astropy/package-template . Also, the template now uses cookiecutter.

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions