Sublime Forum

No build system - matplotlib/python3

#1

i have tried solution from another topic (SublimeText3 won’t import matplotlib but terminal does)

I have this 2 versions of python, and i use this path

“C:\Users\Splendor\AppData\Local\Programs\Python\Python37\python.exe”

when creating a new building system, but it doesn’t work.

After i run the code, i get the message “No build system” :frowning:

0 Likes

#2

Can you post what build system did you create & use. Is there any error message in the console ? (you can access the console by pressing ctrl + `)

0 Likes

#3

The message “No build system” means that the sublime-build file you created isn’t valid JSON; hence Sublime can’t load the file, so there’s no build system.

Plugging your build system into https://jsonlint.com/ will show you where it’s broken, but the most common problems are not putting a , between the items in the build and (particularly for windows) trying to specify paths using \ instead of / or '\`.

1 Like

#4

I have used solution from stack overflow.

‘’’
{
“cmd”: [“C:\Users\Splendor\AppData\Local\Programs\Python\Python37\python.exe”, “-u”, “$file”],
// ^^^^^^^^^^^^^^^^^^^^^
“file_regex”: “^[ ]File "(…?)”, line ([0-9]*)",
“selector”: “source.python”
}
‘’’’’
there is no error in console :frowning:

at https://jsonlint.com/ i get error at very beginning :f(

0 Likes

#5

This is one problem. The \ character is special in JSON, it’s used to tell the JSON parser that the next character should not be treated specially. There is no such escape sequence\U, \S, 'A', etc. You need to replace all of them with \\ or /. Similarly, the " character is for wrapping the characters in a string. If you try to put one in the middle of a string (like in your file_regex) then you’re ending the string at that point and what follows is no longer in the string. Thus in that case you need to replace them with \" instead to indicate that the " is not to be treated specially.

Sublime doesn’t generate errors in the console when build systems are broken, but jsonlint is already telling you what parts are broken.

0 Likes

#6

so i have someting like this:

https://pastebin.com/1MTrVWw8

and i get this error:

"Error: Parse error on line 1:
{ \ “cmd”: ["C:\Us
–^
Expecting ‘STRING’, ‘}’, got ‘undefined’

0 Likes

#7

The quotes that are actually wrapping the content of the string are special, they shouldn’t be quoted. Only the quotes inside need to be quoted. JSON uses the same rules as Python does for strings, for example (except that in JSON, only " can be used for strings, while Python allows " and ').

My recommendation would be to open the command palette and choose the command View Package File, and then select the file Python/Python.sublime-build to open a (read only) copy of the Python build system that ships with Sublime.

That’s a template for what the file is supposed to look like, so you can compare and contrast what you have to see what’s different to determine how to fix yours.

Since you seem to be only trying to specify the location of python (instead of just adding it to the PATH so that windows will find it and you could use the default), you can just copy the content out of this one into yours and then fix the first argument in cmd to be what you want.

Remember that when you do that you need to specify something like C:\Python as either C:\\Python or (perhaps more readably) C:/Python.

0 Likes

#8

“That’s a template for what the file is supposed to look like,”

json show erros in this template

" Since you seem to be only trying to specify the location of python (instead of just adding it to the PATH so that windows will find it and you could use the default)"

So there is easier solution?

0 Likes

#9

so i have something like this

https://pastebin.com/V1VS82AF

still nothing happens but i have no more error ‘no building system’

0 Likes

#10

Sublime’s JSON parser is more lenient than standard JSON, it doesn’t get all uptight about commas following the last item in the list. If you remove the comma from the end of the line on line 12 (the second shell_cmd) it will validate OK.

Operating systems have something referred to as the PATH; it’s a list of all of the folders on your hard drive where you have programs installed that you’d like to be able to run without entering their full path. If the location of python.exe is in the PATH, then just saying python will find it and execute it.

Python generally adds itself to the path when you install it, assuming you say yes when it asks you. Otherwise you can adjust it manually. How you do that depends on what operating system you’re using, and what version of it. If you google how to modify the PATH for your specific OS, you’ll find instructions.

Adding C:\Users\Splendor\AppData\Local\Programs\Python\Python37\ to the PATH would allow you to use the built in Python build system.

The value of shell_cmd has to be a single string; the value of cmd has to be a list of strings. Swapping the first instance of shell_cmd with cmd might fix it up for you.

0 Likes