python-3.xdirectoryinterpreter

Trying to run from VSCode instead of the Terminal since Pressing a button is way easier then going into to the terminal


I just got a new Macbook Pro and I wanted to see running code from VScode works. So I created a simple hello world in python and I keep getting an errror. I have anaconda downloaded and I am using the base conda Interpreter. Shows the kind of error I have.

''' /Users/joshuadeville/anaconda3/bin/python "/Users/joshuadeville/DevFold er/print("hello world").py" /Users/joshuadeville/anaconda3/bin/python: can't open file '/Users/joshuadeville/DevFolder/print(hello': [Errno 2] No such file or directory '''

This is the error I keep getting but say if ran the code through the terninal python3 helloworld.py, it would work. I just wnat to press the run button in the top hand corner

I tried using different interpeters that VScode provided but it did not work. For example if I were to use the python 3.9.6 64-bit interpreter it would give me a different error messssage. Mostly the same but a little different.

 /usr/bin/python3 "/Users/joshuadeville/DevFolder/print("hello world").py"
/Library/Developer/CommandLineTools/usr/bin/python3: can't open file '/Users/joshuadeville/DevFolder/print(hello': [Errno 2] No such file or directory

/Library/Developer/CommandLineTools/usr/bin/python3 is the part thats different and I dont understand why. The goal is to get the programming running from pushing the button in the top right corner. Any help would be greatly appreciated. another thing I am new to programming

Error message of the trying a different interpreter


Solution

  • Kindly rename your file from print("hello world").py to print_hello_world.py and then try to execute again. It does not accept inverted commas( "" ) in the filename, thus getting error.