As the name implies it is a scratch file and not attached to any project. It is extremely useful to run some temporary stuff before you plan on using in a project. It is saved to a separate location and indexed. The code on the scratch can be run and debugged. What is more it is color coded.
How do you work with a scratch file?
It is very easy as shown in the PyCharm IDE. From the main menu you can access this dropdown when you click File.
Herein, for demo I shall create a python file and test run it. When I choose a Python code, it creates a file scratch.py and saves it to the Scratches directory. I write this simple code in the scratch.py file,
print("Scratchy") as shown.
Now you can run this file and the interpreter picks it up. After highlighting the scratch.py file in the Scratches folder, with a right click you display this dropdown.
In addition to fully functional files show above, you can also use the Scratch Buffers. These can not be run as they are just text files. You need to create a scratch buffer to store these(also indexed and rotated). It is an excellent feature to keep codes, code scratches, and anything else you want to come back to.
How to create a Scratch buffer file?
Ctrl+Shift+A brings up a window. In the window start type in "New Scratch.." and you get some choices. Choose New Scratch Buffer and a buffer1.txt is created wherein you can keep your notes. These files are also stored in the Scratches node.
No comments:
Post a Comment