question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not recogize Python 3.x

See original GitHub issue

Issue Type: Bug

  1. Selected Python 3.7.4 64-bit as my Python interpeter.

  2. Attempting to use “input” vs. “raw_input” in a basic Hello World type file. The code is:

myName = input('What is your name? ')
print('hello ')
print(myName)
  1. When here’s the output
What is your name? Bob
Traceback (most recent call last):
  File "hello-world.py", line 1, in <module>
    myName = input('What is your name? ')
  File "<string>", line 1, in <module>
NameError: name 'Bob' is not defined
  1. If I switch “input” to “raw_input” it runs fine, which leads me to believe VS Code cannot see a Python 3.x interpreter.

Extension version: 2019.9.34911 VS Code version: Code 1.38.1 (b37e54c98e1a74ba89e03073e5a3761284e3ffb0, 2019-09-11T13:31:32.854Z) OS version: Darwin x64 18.7.0

System Info
Item Value
CPUs Intel® Core™ i7-5557U CPU @ 3.10GHz (4 x 3100)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 3, 4, 4
Memory (System) 16.00GB (4.08GB free)
Process Argv
Screen Reader no
VM 0%

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
Asa-Phelpscommented, Oct 16, 2019

Thank you again! New to VS Code and appreciate the pointers. 👍🏻

On Oct 16, 2019, at 11:39 AM, Kim-Adeline Miguel notifications@github.com wrote:

Glad to hear you got it figured out!

Yes it is the expected behaviour on Mac: macOS ships with Python2.7, so if you run which python in your shell (even outside of VS Code) it will return the path to Python 2.7. The “Select Interpreter” feature of the extension doesn’t override the python path in the shell unless you use a virtual environment, so in order to be able to use Python 3.x there you can either:

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode-python%2Fissues%2F7660%3Femail_source%3Dnotifications%26email_token%3DANKQZXVQBKSY54LBTAKRX43QO47TLA5CNFSM4I3QJY6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBNEZGY%23issuecomment-542788763&data=02|01||ed6aa55101574671e6d408d75257638d|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637068407589498073&sdata=89dVFTN%2BlAgA8tQFmFAP54ZzalXLhpcKSLO9KdNxh%2BY%3D&reserved=0, or unsubscribehttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANKQZXU7HPKNSFW7RJT34TTQO47TLANCNFSM4I3QJY6A&data=02|01||ed6aa55101574671e6d408d75257638d|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637068407589508072&sdata=FAYATUjcjT1VZrm%2FNyHwjXN10B%2FMJD1RN7oiGj8kdL8%3D&reserved=0.

1reaction
Asa-Phelpscommented, Oct 16, 2019

I think I figured it out.

instead of running “python test.py” in the default “zsh” shell, if I right-click on “test.py” and select “Run Python File in Terminal” it appears to work properly. Not sure if it’s the expected behavior in VS Code on the Mac, but it is now working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'python3' is not recognized as an internal or external ...
In short, I reinstalled python and made sure to add it to PATH. Then, in settings, Apps > Apps & Features > App...
Read more >
Err: Python is not recognized as an internal or external ...
The “Python is not recognized as an internal or external command” error is encountered in the command prompt of Windows. The error is...
Read more >
Python is not recognized as an internal or external command
One way to fix the error would be to launch Python from the Command Prompt by passing in the full path to the...
Read more >
python3 is not recognized as an internal or external command ...
Does the python3 executable exist? · Have you added the path to your Python installation directory to your PATH environment system variable?
Read more >
What's New In Python 3.0 — Python 3.11.1 documentation
The built-in basestring abstract type was removed. Use str instead. The str and bytes types don't have functionality enough in common to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found