1

I save the below snippet into a file, say, stackoverflow.py and go to terminal and run (within my conda env) then everything is fine. But in VS Code, under the same conda env, it hits Invalid Syntax. The white screenshot is the result from Mac Terminal, the black one is from VS Code Terminal. I'm wondering what happened. Thanks

import requests

request = requests.get("https://drive.google.com/uc?export=download&id=0B6ZlG_Eygdj-c1kzcmUxN05VUXM")
with open("survey.zip", "wb") as file: 
    file.write(request.content)

enter image description here

enter image description here

EyeQ Tech
  • 7,198
  • 18
  • 72
  • 126
  • how do you run it ? You have to run it in terminal but it seems you run it Python shell. Start terminal with Bash, not with Python. – furas Oct 20 '19 at 22:20

1 Answers1

1

From the screenshot it seems when you run it in VS code, your command is being executed in python shell (as python code) and not in terminal.

Just make sure you are using the correct shell when running your command. You can see the active shell in the screenshot where it says "2: python" (in the drop down menu).

Moshe perez
  • 1,626
  • 1
  • 8
  • 17