[PYTHON] [Sublime Text 2] Always execute a specific file in the project

How to execute a specific file in a project created with Sublime Text 2. (Command + B without settings will always execute open files)

If you set "build_systems" as follows in "Project> Edit Project" from the menu, "app.py" at the root of the project will always be executed. And make the project file the root directory.

setting file

{
	"folders":
	[
		{
			//name
			"name": "stg001",
			//Directories to include in the project
			"path": ".",
			//Excluded directories
			"folder_exclude_patterns": [".ropeproject"],
			//Files to exclude
			"file_exclude_patterns": ["*.bmp", "*.png ", "*.wav", "*.ogg", "*.sublime*"]
		}
	],
	//Project-specific settings
	"settings":
	{
		"tab_size": 4
	},
	//Project-specific build settings
	//reference(http://y-anz-m.blogspot.jp/2012/11/sublime-text-2-typescript.html)
	"build_systems":
	[
		{
			"name": "stg001",
			// app.Always run py
			"cmd": ["python", "-u", "$project_path/app.py"],
			//Root the folder containing the project files
			"working_dir": "$project_path",
			"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
			"selector": "source.python"
		}
	]
}

reference

Build TypeScript with Sublime Text 2

Recommended Posts

[Sublime Text 2] Always execute a specific file in the project
Count specific strings in a file
Create a plugin that always highlights arbitrary text in Sublime Text 2
Replace the named entity in the read text file with a label (using GiNZA)
Get the file name in a folder using glob
[Python] Change the text color and background color of a specific keyword in print output
Save the pystan model and results in a pickle file
Download the file in Python
A program that removes specific characters from the entered text
Change the standard output destination to a file in Python
Get the number of specific elements in a python list
[Note] Import of a file in the parent directory in Python
Export a gzip-compressed text file
[Python scraping] Output the URL and title of the site containing a specific keyword to a text file
Output the key list included in S3 Bucket to a file
Process the contents of the file in order with a shell script
Anyway, the fastest serial communication log is left in a file
Outputs a line containing the specified character string from a text file
Save the Pydrive authentication file in a different directory from the script
Read a file in Python with a relative path from the program
Read the config file in Go language! Introducing a simple sample
Get the formula in an excel file as a string in Python
[Golang] Check if a specific character string is included in the character string
GOTO in Python with Sublime Text 3
Save the binary file in Python
Save a specific variable in tensorflow.session
Create a binary file in Python
The story of the "hole" in the file
Save a YAML-formatted file in PyYAML
Check if there is a specific symbol in the executable file and its dependent libraries (simplified version)
Replace the directory name and the file name in the directory together with a Linux command.
What is the XX file at the root of a popular Python project?
A memo organized by renaming the file names in the folder with python
How to specify a .ui file in the dialog / widget GUI in PySide
Extract lines that match the conditions from a text file with python
When you make a mistake in the directory where you execute `pipenv install`
Test & Debug Tips: Create a file of the specified size in Python
View the full path (absolute path) of a file in a directory in Linux Bash
I made a program to check the size of a file in Python
Write the test in a python docstring
Cut out A4 print in the image
Change the list in a for statement
Create a large text file with shellscript
Run the Python interpreter in a script
Read the file line by line in Python
Read the file line by line in Python
[GPS] Create a kml file in Python
[Python] Read the specified line in the file
Arrange the numbers in a spiral shape
Various ways to read the last line of a csv file in Python
Create a Python image in Django without a dummy image file and test the image upload
If branch depending on whether there is a specific element in the list
Create a plugin that allows you to search Sublime Text 3 tabs in Python
Save the setting conditions as a CSV file using UDF Manager in OCTA
Attempt to launch another .exe and save the console output to a text file
I made an appdo command to execute a command in the context of the app
Addressed an issue where IIS couldn't import a pyd file in a Django project
Create a Django project and application in a Python virtual environment and start the server
A memorandum of how to execute the! Sudo magic command in Jupyter Notebook
What to do if a Unicode Encode Error occurs in Sublime Text Python
Don't forget to close the file just because it's in a temporary folder