Search code examples
pythonsublimetext3python-idlebuild-system

How can I create a build system in Sublime Text to run my python code in an IDLE shell?


How can I run my code from Sublime Text in an IDLE shell. I much prefer using IDLE to run my code when I'm writing it because it's really easy to debug. However I love Sublime Text and much prefer to actually write the script with it.

I'm trying to create a build system which runs my code with IDLE3.

However, when I do this, it simply opens an IDLE shell but doesn't run my file.

{
    "shell_cmd": "/Library/Frameworks/Python.framework/Versions/3.8/bin/idle3.8"
} 

And when I do this it opens my script with IDLE but doesn't run in the shell.

{
    "shell_cmd": ["/Library/Frameworks/Python.framework/Versions/3.8/bin/idle3.8","$file"]
} 

How can I get it to run the file in an IDLE shell?


Solution

  • I worked it out.

    It's done like this:

    {
        "cmd": ["/Library/Frameworks/Python.framework/Versions/3.8/bin/idle3", "-r", "$file"]
    }
    

    The example on the docs shows "-d" and it opens in debug mode so I had an educated guess and replaced it with "-r" which I guess means 'run'?