I've made a little project that includes importing various python files into another python files. Here's my directory structure.
Main_Folder
|_ my_main_file.py
|_ Sites (a directory inside Main_Folder)
|_ __init__.py
|_ some_other.py
This is basically my directory structure. This some_other.py
is imported inside my my_main_file.py
by the following command :
from Sites import *
I'm importing everything from that directory. So, what I wanted to do was make this whole project into a standalone binary. I use pyintaller to convert my .py
files into .exe
. But, I've only written scripts that have everything in 1 file, which makes the task easy. But, this time, I'm trying to do something new.
My python script takes command line arguments and it is working. The python script will not work without command line arguments. I can convert to exe, but that exe is doing nothing even when I give arguments.
So, I got a .spec
file from pyinstaller and modified it to get my some_other.py
file. SPEC file looks like this :
# -*- mode: python -*-
block_cipher = None
a = Analysis(['my_main_file.py'],
pathex=['C:\\Users\\User Name\\Main_Folder'],
binaries=None,
datas=[('Sites/*.py','Sites')],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='my_main_file',
debug=False,
strip=False,
upx=True,
console=True )
This makes an .exe
, but that exe won't work.The exe won't show anything. But, it is like 11 MB in size. Got anything for this?
I tried nuitka
, but that one gives out an error about not being able to find gendef.exe
and I'm not really interested in installing minGW.
Btw, I'm on a 64 bit machine and py2exe's bundle_file:1
won't work for me.