Python Forum
input function visual studio terminal help - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: input function visual studio terminal help (/thread-6751.html)



input function visual studio terminal help - JJG - Dec-06-2017

hi all, i been trying to figure out how to get the integrated terminal to work in visual studio code and i have no clue what going on. I have Extension Python Pack install by Don Jayamanne. I also added path to python in VS settings *python.pythonpath":"/usr/bin/python"* I also tried add configuration " add python terminal (integrate). Is there something I'm missing or am i doing something wrong? I followed https://donjayamanne.github.io/pythonVSCodeDocs/docs/debugging_terminal-console-apps/ but does not work. Thanks for all your help so far.
 name = input("Please enter your name: ")
print("hello, " + name + "!")JJG-MacBook-Pro:python_work Beware$ python input.py
Please enter your name: dude
Traceback (most recent call last):
  File "input.py", line 1, in <module>
    name = input("Please enter your name: ")
  File "<string>", line 1, in <module>
NameError: name 'dude' is not defined
JJG-MacBook-Pro:python_work Beware$



RE: input function visual studio terminal help - JJG - Dec-06-2017

One other thing too add, I installed python 3.6.
When i use my mac terminal and I type python I get - Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

When i type python3 in the mac terminal I get - Python 3.6.3 (v3.6.3:2c5fed86e0, Oct 3 2017, 00:32:08)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Would this cause any problems having both installed? i guess python 2.7 comes pre-installed with mac computers?

thanks


Update:
I changed paths inside VS user settings to python3 /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 and VS Integrated Terminal is working now, that solved my problem



thanks