-1

This is the code I am primarily trying to get to work. It runs fine when I run it in Spyder (Python 3.8). However when running the .bat file I get the following error message.

urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

I also tried running a less complex piece of code that also doesn't work, its error message is as follows. (This now works, see below)

ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.

My code for the .bat files are as follows (I think my .bat file code is fine, as one of them now runs perfectly, so it's not a path issue):

C:\Users\Thomas\Desktop\Coding\Python\Chess_Files>"C:\Users\Thomas\Anaconda3\python.exe" "C:\Users\Thomas\Desktop\Coding\Python\Python_Code\lichessAPI.py"
C:\Users\Thomas\Desktop\Coding\Python\Chess_Files>"C:\Users\Thomas\Anaconda3\python.exe" "C:\Users\Thomas\Desktop\Coding\Python\Python_Code\planetorbits.py"

UPDATE: I was able to get the second .bat file of code to work, by uninstalling and reinstalling both numpy and matplotlib using pip. However, the first .bat file is still running into the same error.

It has been suggested that I install openSSL, I'm not sure what that even is and why I can't just use urllib3 seeing as that works when I run the code myself in anaconda.

FINAL UPDATE: I have found a solution and posted it below. Hope this helps.

  • I would suggest comparing the environments in the command tool where you run the .bat files, and inside Spyder, looking for things like PATH, PYTHONPATH, etc, anything that has to do with locating modules. – joao May 17 '21 at 20:44
  • The path you posted is fine, that is how it should be.. Do you have `OpenSSL` installed if not, install it. – Gerhard May 18 '21 at 05:25
  • My suggestion was to **compare** the values of PATH on the two environments you use. – joao May 18 '21 at 05:55

1 Answers1

0

I was able to solve the issue by following advice from Matt Dnv:

Requests (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.") Error in PyCharm requesting website

I copied and pasted the following:

libcrypto-1_1-x64.*
libssl-1_1-x64.*

from D:\Anaconda3\Library\bin to D:\Anaconda3\DLLs