PyCharm - no route to host
I have a small Python program that calls `response = requests.get(url)` to retrieve a page from a host on the same subnet.
When I execute the program in the debugger, it fails with this message:
Error fetching URL: HTTPConnectionPool(host='192.168.253.158', port=35482): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x127d51690>: Failed to establish a new connection: [Errno 65] No route to host'))
If I execute the script with `python3 script.py` it works as expected.
What other debugging info could I provide? Many thanks.
请先登录再写评论。
Hi there
Thank you for reaching out,
May I ask if you are using local or remote python interpreter?
Would it be possible to send the IDE logs shortly after replicating the issue (from Help | Collect Logs and Diagnostics data)
do you have any proxy in use in your environment to your knowledge ?
Does the issue only happen when you debug the program or also when you run it from Pycharm?
Kind regards
Sorry for the delayed response. I am using PyCharm 2024.3.3 (Community Edition) on my macOS 15.3.1 M3 processor (Macbook air). I am running locally, using Ctl-R to run the Python program. It also fails if I use Ctl-D to start it in the debugger. I do not have any proxies.
This is the code. If I change the URL to use 192.168.253.1:80 (my local router's web GUI), it works.
I don't know how to send all the debug logs in this report - I see the .zip file - which ones are important? Thanks.
import sysimport requestsfrom pyparsing import htmlCommentfrom trilium_py.client import ETAPIdef fetch_html_from_url(url):try:response = requests.get(url)response.raise_for_status()return response.textexcept requests.RequestException as e:print(f"Error fetching URL: {e}")sys.exit(1)html_content = fetch_html_from_url("http://192.168.253.158:35482")print(html_content)I
HI Richard
Is it possible to upload the whole .zip file (just one file)?
The issue looks likely a system/network issue so will you please also provide me the output (screenshot) of the following commands:
telnet 192.168.253.158 35482curl -vhttp://192.168.253.158:35482If possible to have a look at a screenshot when running the python file from the PyCharm embedded terminal would be also useful
Kind regards,