How to direct python to use a specific network adapter? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Networking (https://python-forum.io/forum-12.html) +--- Thread: How to direct python to use a specific network adapter? (/thread-5966.html) |
How to direct python to use a specific network adapter? - ormesome - Oct-30-2017 This is a copy of a thread I started on StackOverflow which is getting down voted for being off topic. I regret that I didn't think to ask the good folks here first. https://stackoverflow.com/questions/47007003/how-to-direct-python-to-use-a-specific-network-adapter Python (3.6) works great on my wired network adapter but I am unable to run pip (or pycurl or urllib) when on the wireless. I receive the following error, which led me to believe that it's proxy related: But I'm not behind a proxy and I know how to set the proxy for pip, pycurl, and urllib.How do I tell the python environment that I want it to direct all traffic over the wireless adapter instead of the wired adapter? FYI, I'm always on wireless. The only time I have to connect to the wire is to do python network things. RE: How to direct python to use a specific network adapter? - nilamo - Nov-02-2017 Wired vs wireless is outside python's scope. Is that the error you get without a wired connection? RE: How to direct python to use a specific network adapter? - ormesome - Nov-02-2017 That's the error I get on wireless. When I'm on the wired connection I have no errors. Given that the issue affects a range of network related python packages I assumed that there was a shared base package that required an environment variable or something to be configured. I don't have any problems with other applications (IE, powershell, email, etc) RE: How to direct python to use a specific network adapter? - DeaD_EyE - Nov-02-2017 This is not a Python related problem. I looks like the nameserver is not reachable or the Proxy is not configured right or reachable. It's the task of the OS to handle this connectivity stuff. You can set proxy servers as environment variables: https://stackoverflow.com/questions/22059670/how-can-i-set-a-proxy-server-for-gem?answertab=votes#tab-top RE: How to direct python to use a specific network adapter? - wavic - Nov-02-2017 This is not related to Python. Python just uses an existing connection. Python is in the application layer. It communicates with the system, which is communicating with the drivers and the last one in the chain is the hardware. Try it. Ping the pypi.python.org. Or tracert it RE: How to direct python to use a specific network adapter? - ormesome - Nov-02-2017 I know you say it's not python, that I should check my proxy, but I don't have a proxy either at home or in the office I'm visiting today. The OS says that I have a perfectly fine network connection. Python does not agree.
RE: How to direct python to use a specific network adapter? - wavic - Nov-02-2017 Try to set up a proxy server for your connection and pass it to pip as option: pip install <packet> --proxy="proxy_server:port" There is something wrong with your connection. Check which port pip is using check the router NAT. RE: How to direct python to use a specific network adapter? - sparkz_alot - Nov-02-2017 Perhaps you could post the code you are using that you are using for the connection (between code tags). If you have access to the router, you should be able to see if the computer is connected to the wired and or wireless port(s). If both adapters are 'Active', try manually disabling the wired adapter manually. Some BIOS's don't allow both wired and wifi at the same time, so you may want to check that. There is this post https://social.technet.microsoft.com/Forums/en-US/1b2d9ce7-68ad-4fa1-bc2c-eff34b818acf/wifi-and-ethernet-same-time-windows-10?forum=win10itprogeneral (see the last post), just make sure you can undo any changes you make should the need arise. Again, it would be helpful to see the code you are using to make the connection. RE: How to direct python to use a specific network adapter? - ormesome - Nov-06-2017 I identified that the http_proxy and https_proxy environment variables for a specific office (the only place I used a wired connection) had been set. Removing those variables has fixed the problem. I'm a little annoyed that these environment variables somehow trump everything else, but I've learned something new. Thank you all. RE: How to direct python to use a specific network adapter? - nilamo - Nov-08-2017 Thanks for coming back and letting us know what happened :) |