Reputation: 11
I've watched videos on how to work with python3 within sublime text editor. I went through a series of steps to add a python 3 build system:
In Sublime:
1 - Went to tools in the menu bar 2- selected Build System 3 - New Build System - This step opens a new sublime window and I pasted this code:
{
"cmd": ["C:\Users\ajsae\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.8", "$file"],
"selector": "source.python",
"file_regex": "file \"(...*?)\", line ([0-9]+)"
}
This particular line here seems to be where my python 3 is located:
C:\Users\ajsae\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.8
I noticed that most of the videos I watched showed a similar address. Something like this:
"/usr/bin/python3"
Once I set up my path and save the New Build System, and try to run my code, It doesn't do aything at all.
This is the code I'm trying to run in sublime's integrated terminal:
for left in range(7):
for right in range(left, 7):
print("[" + str(left) + "|" + str(right) + "]", end=" ")
print()
The piece of the code that is not supported by older versions of python is end=" ", so I get an error and my code won't run.
I hope someone can lend me a hand.
Upvotes: 0
Views: 223
Reputation: 79
Add python3 in the sublime text to build
Goto: "Menu > Tools > Build System > new Build System"
{
"shell_cmd":"/usr/bin/python3 \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.py, source.python",
}
Copy this setting code and paste in this file & save it as "Python3.sublime-build".
Now goto "Menu > Tools > Build System " and select Python3.
It will be worked in linux base system only.
Upvotes: 0