I want to create a .exe of a python file but i've divided my program into different .py files

I want to create a .exe of a python file but i've divided my program into different .py files



I am trying to make a .exe(executable) of a python program that I've created in different .py files. I am trying to use pyinstaller on the main file, the one that has the if 'name == "main". All the other files are just my class definitions for the objects used in the program. I reference them by using "from company import Company". I've tried doing


pyinstaller ReportBuilder.py



but it throws a lot of errors, an examples is


AttributeError: 'str' object has no attribute 'items'.



I've tried to add the files to the spec under datas but nothing.



UDPATE: My code works when I compile it and run it.


271, in _safe_import_module
module_basename, module_name, parent_package)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 1993, in _safe_import_module
module_name, file_handle, pathname, metadata)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 2085, in _load_module
self._scan_code(m, co, co_ast)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 2547, in _scan_code
self._process_imports(module)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 2746, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 2224, in _safe_import_hook
target_attr_names=None, level=level, edge_attr=edge_attr)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 1424, in import_hook
source_package, target_module_partname, level)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 1576, in _find_head_package
target_module_headname, target_package_name, source_package)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerdependanalysis.py", line 271, in _safe_import_module
module_basename, module_name, parent_package)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 1993, in _safe_import_module
module_name, file_handle, pathname, metadata)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 2085, in _load_module
self._scan_code(m, co, co_ast)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 2547, in _scan_code
self._process_imports(module)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 2746, in _process_imports
target_module = self._safe_import_hook(*import_info, **kwargs)[0]
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 2224, in _safe_import_hook
target_attr_names=None, level=level, edge_attr=edge_attr)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 1425, in import_hook
target_module = self._load_tail(target_package, target_module_partname)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerlibmodulegraphmodulegraph.py", line 1638, in _load_tail
submodule = self._safe_import_module(head, mname, submodule)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerdependanalysis.py", line 260, in _safe_import_module
hook_module.pre_safe_import_module(hook_api)
File "c:usersmiloappdatalocalprogramspythonpython37-32libsite-packagesPyInstallerhookspre_safe_import_modulehook-urllib3.packages.six.moves.py", line 31, in pre_safe_import_module
for real_module_name, six_module_name in real_to_six_module_name.items():
AttributeError: 'str' object has no attribute 'items'



this is just a small part of what comes back.





Post your code where you see the error?
– ThatBird
Aug 21 at 17:12





Pyinstaller should find the other files through your import statements. post your code and the .spec file created by Pyinstaller
– John Anderson
Aug 21 at 17:12


Pyinstaller


import


.spec


Pyinstaller





And, use Py2Exe instead of pyinstaller.
– Dalen
Aug 21 at 17:16





I vote for nuitka!
– Alan
Aug 21 at 17:18





But does your python code work? (Even before you try to make an exe file.)
– DYZ
Aug 21 at 17:23









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)