Skip to content

Enable __future__ statements in sphinxext plot_directive (Trac #1653) #2249

Closed

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/1653 on 2010-10-29 by @mforbes, assigned to @pv.

Including statements like "from future import division" in the plot_pre_code fails because these are module specific.

One could fix this by changing line 464 of plot_directive.py to something like:

            futures = [l for l in setup.config.plot_pre_code
                       if "from __future__ import" in l]
            exec "\n".join(futures + [code]) in ns

This could probably be made slightly more robust. There may be another way of doing this, but I cannot see how right now.

Michael.

Activity

  1. numpy-gitbot commented on Oct 19, 2012

    @numpy-gitbot
    Author

    Milestone changed to Unscheduled by @rgommers on 2011-03-30

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

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