Running python in Visual Studio 2017 -
i have download vs 2017 pre-release has native python support , trying write script invoke rest method.
#!/usr/bin/env python import requests import sys import urllib3 urllib3.disable_warnings() class myrest(): def __init__(self): self.appliance = "192.168.1.100" base_url = 'https://%s/api/about"' self.base_url = base_url % self.appliance ret = requests.get(self.base_url, verify=false) if __name__ == "__main__": try: myrest = myrest() print("hello") print("=" * 79) print(ret) sleep(10) except exception ex: print ("failed") print(ex) sys.exit(1)
when try run in vs run window pop split second exit means have no idea if code ran ok or not. if run same script in idle see expected console output:
traceback (most recent call last): file "h:\data\visual studio 2017\projects\pythonapplication1\myrest.py", line 5, in import urllib3 importerror: no module named urllib3
i have 2 main problems:
a) how run script vc2017 same output opposed contagiously having switch idle
b) how import urllib3 - have run pip install via vs2017 did requests despite there still error saying module not imported
try downloading urlib3 christoph gohlke's pre-built windows installers , installing local package within visual studio (not pip). should fix b part of issue.
Comments
Post a Comment