Python Console not connecting

I have set up a new project in Python and configured a venv based on installed Python 3.6 on my PC. however the python console continually gives this error when I try to run code:

 

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

However if I go to the terminal and open python there it works fine.

I am currently running PyCharm 2020.1 as my IT dept have so far ignored my requests to allow PyCharm to update and I am not an administrator so I cannot update the software!! 

0
10 comments

Hello, 

 

The error looks like AV, FW  restriction. Do you have any? Please try disabling it. 

0

Ah yes that's probably it. Unfortunately this PC is managed by our IT department and I'm not sure if they will be willing to let it through. I asked before, but as it is impacting my work, hopefully they will!

0
Avatar
Permanently deleted user

I have admin right (and try to use it) and in cmd also connection work fine, and  error only inside PyCharm

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', por
t=8707): Max retries exceeded with url: /hvr/api/users (Caused by NewConnectionEr
ror('<urllib3.connection.HTTPConnection object at 0x000001EA72654AC8>: Failed to
establish a new connection: [WinError 10061] No connection could be made because
the target machine actively refused it'))

also I try to disable firewall - this not helps.

0

@... Firewalls can block network traffic for specific processes. So if PyCharm process is blocked, so is any python process it spawns. Please try disabling any firewall software you may have.

0
Avatar
Permanently deleted user

I disable firewall - this not helps.
also i try run simple testing file

from requests import get
baseurl = "https://openlibrary.org/api/books"
r = get(baseurl)
print(r.status_code)
print(r.text)

and this works correct, but when i try to run this with submodule i get error

0

Well, the issue is specifically when you connect to localhost on port 8707. Try this:

Open terminal in PyCharm and do:

telnet localhost 8707

If you don't have telnet, you can use:

nc -vz localhost 8707

Then do the same test from system terminal (outside of IDE). Share the results.

0
Avatar
Permanently deleted user

telnet

telnet localhost 8707 Connecting To localhost...Could not open connection to the host, on port 8707: Connect failed

 

Test-NetConnection localhost -Port 8707
WARNING: TCP connect to (::1 : 8707) failed
WARNING: TCP connect to (127.0.0.1 : 8707) failed


ComputerName : localhost
RemoteAddress : ::1
RemotePort : 8707
InterfaceAlias : Loopback Pseudo-Interface 1
SourceAddress : ::1
PingSucceeded : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False

0
Avatar
Permanently deleted user

so, what I'll do next?

0

It means this is a network issue external to PyCharm. If you're in corporate network, please ask your system administrator to take a look. Otherwise the issue should be solved on a system level.

0
Avatar
Permanently deleted user

yes, it was not a PyCharm problem, its because I recently add server link for shell script for run venv, but don't append environment variable for PyCharm, so its was the reason why PyCharm try to find sever as localhost

0

Please sign in to leave a comment.