I am trying to use Spyder for Python/Tensorflow within a company's network. Unfortunately I cannot disable the Firewall, which brings some Proxy problems with it.
Using this very basic code
import tensorflow as tf
learn = tf.contrib.learn
tf.logging.set_verbosity(tf.logging.ERROR)
mnist = learn.datasets.load_dataset('mnist')
throws following error
File "C:\Users\xxx\AppData\Local\Continuum\Anaconda3\lib\urllib\request.py", line 1320, in do_open raise URLError(err)
URLError: < urlopen error [Errno 11004] getaddrinfo failed >
Setting environment variables http_proxy and https_proxy does lead to the same problem.
Is there any way to edit proxy settings in Spyder directly? If not: how do I adjust the proxy in python?
import urllib2
proxy_user='xxx'
proxy_password='xxx'
proxy_ip='proxy.company:8080'
proxy_url = 'http://' + proxy_user + ':' + proxy_password + '@' + proxy_ip
proxy_support = urllib2.ProxyHandler({"http":proxy_url})
opener = urllib2.build_opener(proxy_support,urllib2.HTTPHandler)
urllib2.install_opener(opener)
throws following error
ModuleNotFoundError: No module named 'urllib2'
Thanks in advance, Johnny
Open
conda config --set proxy_servers.https "proxy.company.com:8080"Your proxy settings are now ready to be used in Conda environment. Also, you can run your python code from Conda prompt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With