I have a script, which uses gspread for manupilating with Google Drive data. And I want to create a simple executable in Windows. But yet no luck.
Note
What I've tried so far:
PyInstaller
Goes to the step 60020 INFO: Looking for ctypes DLLs and then
blah-blah-blah...
File "C:\Python34\lib\ntpath.py", line 246, in basename
return split(p)[1]
File "C:\Python34\lib\ntpath.py", line 217, in split
d, p = splitdrive(p)
File "C:\Python34\lib\ntpath.py", line 161, in splitdrive
normp = p.replace(_get_altsep(p), sep)
AttributeError: 'tuple' object has no attribute 'replace'
Setup.py (configuration took here)
from distutils.core import setup
import py2exe, sys, os
sys.setrecursionlimit(5000)
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1, 'compressed': True}},
windows = [{'script': "main.py"}],
zipfile = None,
)
Before I added sys.setrecursionlimit(5000)
I was getting RuntimeError: Maximum recursion depth exceeded.
Added sys.setrecursionlimit(5000)
and RuntimeError: maximum recursion depth exceeded in comparison
Error is with mf3 file as here, so I added "excludes":["six.moves.urllib.parse"]
but error is the same.
[Errno 2] No such file or directory
I've tried all methods from here and here here, copied cacerts.txt, cacert.pem but still [Errno 2] No such file or directory
Here is a code of setup.py:
import sys
from cx_Freeze import setup, Executable
import requests.certs
includefiles = ['key.json', (requests.certs.where(),'cacert.pem')]
includes = []
excludes = []
icon = None
base = None
if (sys.platform == "win32"):
base = "Win32GUI"
setup(
name = 'Scraper',
version = '1.0',
author = 'GriMel',
author_email = '[email protected]',
options = {'build_exe': {'excludes':excludes,
'include_files':includefiles,
'icon' : icon}},
executables = [Executable('main.py')],
)
Looking forward to you help.
The actual answer - here So, step by step
CA_CERTS = os.path.join(os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt")
by
CA_CERTS = os.path.join(os.path.dirname(sys.executable), "cacerts.txt")
At least exe, made by cx_freeze now works.