I am creating a discord bot for a, private, small server, with friends. I would like the bot to be runable by any of my friends, none of whom know much about programming.
My idea was to bundle it up on a .exe, using pyinstaller.
It’s my first time using pyinstaller so I might be missing something obvious.
I expected to be able to just double click it and let it run in the background.
The issue is, as far as I’ve put together, that the bot reads and write data from local files, which doesn’t seem to translate well into the packaged .exe.
Beside that, many python modules, made by me, are rising errors when imported, not found.
What I’ve tried:
--add-data "Source;dir"
The files are copied well, but any bot commands that accesses them doesn’t work.
using this, I “solved” the import errors of my own modules, though I am skeptical.
--paths=.venvLibsite-packages
Some of the import errors were solved but others remain, as shown in the image.
error message
The spec file:
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['main.py'],
pathex=['path-to-app-root\.venv\Lib\site-packages'],
binaries=[],
datas=[('static', 'static'), ('mutable', 'mutable'), ('moreCogs', 'moreCogs'), ('musicbot', 'musicbot'), ('snapcogs2', 'snapcogs2')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='racisbot',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
Juan Ignacio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.