I'm using XAMPP on Windows to work on a new version of my website. I have modified the Windows hosts file and the XAMPP Apache httpd-vhosts.conf file so that my browsers access the version of the website that is in my XAMPP htdocs directory. This works fine with my browsers but I want to use Python to access the site as well with code like with the following

from urllib.request import urlopen
webpage = "http://www.thedomain.org/index.html"
page = urlopen(webpage)

Running this code I get the following error:

URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>

Any ideas on what configuration change(s) I need to make so that Python can access the local copy of my website just like it accesses websites normally? Thanks.

1 Answer 1


Ok, not an actual answer but rebooted and restarted XAMPP and the problem has vanished - at least for now. Unknown is whether or not this was a one-time event specific to my system and some sequence of events or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.