Py2exe SSLError exceptions how to win?

Compile a simple script in Python to exe using py2exe. When compiling there are no errors at startup error
requests.exceptions.SSLError: [Errno 2] No such file or directory

Google knows this error, as I understand from discussions, the error is the file cacert.pem. Put it next to the. exe without any changes. Someone has solved such a problem ?
Here is the code you are compiling
# -*- coding: utf-8 -*-
from win32com import client
import telepot
import ConfigParser
import codecs
import os

config = ConfigParser.RawConfigParser()
config.readfp('config.ini', 'r', 'cp1251'))#Set the name of the ini file
path = config.get('main', 'path')
chatID = config.get('main', 'chatid')
print (path)
print (chatID)

#Last page xls 2 pdf
xlApp = client.Dispatch("Excel.Application")
books = xlApp.Workbooks.Open(path)
t= books.Worksheets.count # the number of sheets

ws = books.Worksheets[t-1]
n = # the name of the sheet
print (n)
report = 'C:\\test\\'+n+'.pdf'
ws.Visible = 1
ws.ExportAsFixedFormat(0, report)

TOKEN = '207266730:AAF5BXGKTIEmS8-RbwCqXPcCKnL7yorhmP4'
bot = telepot.Bot(TOKEN)
f = open(report, 'rb') # some file on local disk
n2 = "Report "
n2UTF = unicode(n2, 'utf-8', errors='replace')
Text = n2UTF + n
message = bot.sendMessage(chatID,Text)
response = bot.sendDocument(chatID, f)
print report
July 12th 19 at 17:24
1 answer
July 12th 19 at 17:26
I decided, but only did with the help of cx_Freeze. Everything was solved by writing a small module ca_certs_locater:
import os
import sys

def get():
 return os.path.join(os.path.dirname(os.path.abspath(sys.executable if getattr(sys, "frozen", False) else __file__)), "cacerts.txt")

A build script like this:
import os

import httplib2
from cx_Freeze import setup, Executable

 "build_exe": {
 "packages": [
 "ca_certs_locater", ...
 "include_files": [
 os.path.join(os.path.dirname(os.path.abspath(httplib2.__file__)), "cacerts.txt"),
 "excludes": [

The only BUT: it is applicable when using httplib2. In other cases, you need to find a place where the path to cacerts and change it to the desired (possibly there is the same hook as httplib2).

Find more questions by tags py2exePython