Unit 1, Lesson 9 - Running Python Code

Course: Complete Python Mastery
Unit: 1 - Getting Started
Lesson: 9 - Running Python Code

Mosh talks about the command that is executed to run the program and highlights “python -u”

He then directs me to click on Code -> Preferences -> Settings. These all work fine. He then describes a “…” for me to click on. The “…” does not exist for me. He then clicks on open settings.json.

Is there another way I can open settings.json?

2 Likes

Okay, I think I’ve made it to usersettings.json, but I’m not having another issue. Where mosh is able to edit the right side:

I’m not able to edit anything.

Any thoughts on what I can do to change this setting?

1 Like

How did you make it to usersettings.jason

What I did was I pressed cmd shift p, then searched for json, then I clicked on open user settings, the after than, go to bottom of the user settings, and to the right of true, type a “,” then enter, and then do “” and type code-runner.executorMap, then change the python to python3


How to make it on Windows? I don’t even have a “Code” button!

On Windows it’s File/Preferences/Settings or shortcut Ctrl-, .

hi, so i have the same Problem and i dont know what do do anymore. Will there no updated Video how to change that python -U with the new Version of Visual Studio code? All these answers here do not help me going past that lesson 9 or can i just move on without changing python- U to python 3 ? Or can someone make a short Video how to do it ?

In order to change the settings, you need to add code-runner.executorMap to your personal settings.json file.

I made a step-by-step screenshot tutorial that I think is pretty straight forward if you’re on OSX. I’m not sure if it directly translates to Windows 10.

I’m brand new to all of this myself but if you have any questions, I might be able to figure it out.

Tutorial here: https://imgur.com/a/q1vadIr

2 Likes

Yes i have a mac. And i tried to make that change in the Settings but now i get these errors.

Here’s my entire settings.json file:

It just looks like you have some formatting (for lack of a better term?) errors or something like that in yours, but I could be very wrong about that. Do you mind posting a screen shot of your entire settings.json file?

I actually dont know how to get to these settings on the screenshot because i reinstalled code visual studio and also the newest python version 3.9.0 and now when i go to the settings i just see this empty field

That’s probably where you want to be. You need to reinstall the add-ons he covers in the previous lectures along with the code runner extension.

what add-ons do you mean for example ?
what if i just add code-runner.executorMap here ?

See Unit 1 Lesson 6, you need to install the Python extension as well as the Code Runner extension, as well as the pylint linter

Thank you! I was able to solve the same problem with your help!
Appreciate it! :+1:

1 Like

i use windows. so this may not applicable for mac users:
click the setting icon or press ctrl+p
in the search bar that you see(no need to worry about the three dots), type “coderunner:executormap”
you will see it below there, in underlined form, click that.

I cant install pylinter… i never get the little box in the bottom right to pop up asking if you want to install… I mistakenly clicked “do not show again” before I realized he wanted me to install that…

Simply install it under the extensions tab

I have Python installed… when I type Pylinter under Extension tab, it does not show up. Isn’t pylinter something bundled into Python?

Pylinter does not engage as it does in Mosh’s video for Unit 1, #6.

Could it be because I have Python 3.9?.. on Mac?

may be you dont need to install pylint. Intentionally, type a wrong code and see if it marks it with the red underline