Matplotlib plots not displaying in sublimetext


I've recently started using sublimetext 2, however I noticed today that the function doesn't seem to work when run within sublimetext.

If for example I create the following script:

import matplotlib.pyplot as plt

Running this with IDLE generates a plot, however using sublimetext no output is generated. It just keeps 'thinking' until I end the python.exe process after which [Finished] is output.

Have I misunderstood how sublimetext is meant to be used?


5/31/2012 10:33:12 AM

Accepted Answer

My guess would be that Sublime Text 2 launches your code in its own environment, and only traps and displays the console output. The same problem exists when using GUI's, such as wxPython.

Another work around is to open the command prompt and launch it manually (python

EDIT: Here it states that "Under Windows, GUIs are supressed."

EDIT 2: Here it lists a way to fix it, right at the bottom of the page.

5/31/2012 12:01:33 PM

More appropriate way is to just add one line in default Python build system file:

"shell": true

Or make additional Python build system with:

    "cmd": ["python", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "shell": true

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow