SSLError while running python script from console

Question:

I have a problem with following script:

import requests

path = 'https://www.google.com/'

r = requests.get(path)

print(r.status_code)

When I am running this code in spyder IDE it is working properly.

When I am running it from console with commands:

activate my_env
python script.py

It is also working.

But when I am running it from console with command:

C:UsersuserAppDataLocalcondacondaenvsmy_envpython.exe script.py

It gives me error:

requests.exceptions.SSLError: HTTPSConnectionPool(host=’www.google.com’, port=44
3): Max retries exceeded with url: / (Caused by SSLError(“Can’t connect to HTTPS
URL because the SSL module is not available.”))

I was trying to add proxies param and certificate location to verify param, but nothing seems to help.

I am using python 3.7 and my working environment is Windows Server 2012.

Asked By: marcin

||

Answers:

I was able to find answer, I can’t believe I haven’t seen it before.

In short, copy files libcrypto-1_1-x64.*, libssl-1_1-x64.* from D:Anaconda3Librarybin to D:Anaconda3DLLs.

Answered By: marcin
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.