Skip to content

config.py uses imp.load_source which is deprecated in Python 3 #214

@pfmoore

Description

@pfmoore

In Python 3, imp.load_source is undocumented (apparently it was deprecated and removed via http://bugs.python.org/issue14551 with some discussion of how it is "fundamentally broken" in https://mail.python.org/pipermail/python-ideas/2014-December/030265.html).

On Windows under Python 3.3, the invoke tests fail somewhere in the compatibility implementation of imp.load_source.

An alternative approach to loading config from Python files should be implemented for Python 3. Would something like the following work?

import tokenize

values = {}
with tokenize.open(filename) as f:
    exec(f.read(), values)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions