Reputation: 19
I have multiple python files which have modules I've created in them. The files depend on each other for modules.
Currently, I have all of them in one folder
main.py
readfile.py
pronunciation.py
meaning.py
classes.py
The only modules I've used are the inbuilt random (Which I'm not sure how to add in either). Here is my current code
from cx_Freeze import setup,Executable
includefiles = []
includes = ['classes.py','pronunciation.py','readfile.py','meaning.py']
excludes = []
packages = []
setup(name = 'Revision',
version = '0.1',
description = 'Revision program for studying',
author = '',
author_email = '',
options = {'build_exe': {'includes': includes,'excludes':excludes,'packages':packages,'include_files':includefiles}},
executables = [Executable('main.py')])
From this, I'm getting an ImportError, saying that the module classes.py does not exists (It is imported in meaning.py), how do I fix this? Also, I'm worried that cx_freeze might not import random.
Am on windows too, btw.
Upvotes: 1
Views: 161
Reputation: 734
try to replace
includes = ['classes.py','pronunciation.py','readfile.py','meaning.py']
with
includes = ['classes','pronunciation','readfile','meaning']
this list contains modules to be imported during building. In Python we don't specify *.py extension in imports.
BTW. In Python's terms *.py files = modules, it's the same.
Upvotes: 1