packaging python code

Mahmood Naderan nt_mahmood at yahoo.com
Mon May 8 10:36:19 EDT 2017



OK. I did that but it fails! Please see the stack 


D:\ThinkPad\Documents\NetBeansProjects\ExcelTest>pyinstaller exread.py
96 INFO: PyInstaller: 3.2.1
96 INFO: Python: 3.6.1
98 INFO: Platform: Windows-10-10.0.14393-SP0
103 INFO: wrote D:\ThinkPad\Documents\NetBeansProjects\ExcelTest\exread.spec
109 INFO: UPX is not available.
111 INFO: Extending PYTHONPATH with paths
['D:\\ThinkPad\\Documents\\NetBeansProjects\\ExcelTest',
'D:\\ThinkPad\\Documents\\NetBeansProjects\\ExcelTest']
112 INFO: checking Analysis
113 INFO: Building Analysis because out00-Analysis.toc is non existent
113 INFO: Initializing module dependency graph...
117 INFO: Initializing module graph hooks...
119 INFO: Analyzing base_library.zip ...
Traceback (most recent call last):
File "C:\Users\ThinkPad\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\build_main.py", line 788, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\build_main.py", line 734, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\build_main.py", line 212, in __init__
self.__postinit__()
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in __postinit__
self.assemble()
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\build_main.py", line 317, in assemble
excludes=self.excludes, user_hook_dirs=self.hookspath)
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\depend\analysis.py", line 560, in initialize_modgraph
graph.import_hook(m)
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1509, in import_hook
source_package, target_module_partname, level)
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1661, in _find_head_package
target_module_headname, target_package_name, source_package)
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\depend\analysis.py", line 209, in _safe_import_module
module_basename, module_name, parent_package)
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2077, in _safe_import_module
module_name, file_handle, pathname, metadata)
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2167, in _load_module
self._scan_code(m, co, co_ast)
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2585, in _scan_code
module, module_code_object, is_scanning_imports=False)
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2831, in _scan_bytecode
global_attr_name = get_operation_arg_name()
File "c:\users\thinkpad\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 2731, in get_operation_arg_name
return module_code_object.co_names[co_names_index]
IndexError: tuple index out of range

D:\ThinkPad\Documents\NetBeansProjects\ExcelTest>


 
Regards,
Mahmood







On Monday, May 8, 2017 5:07 PM, Lutz Horn <lutz.horn at posteo.de> wrote:



> Is there any way to pack my .py with all required libraries and create a self running package?

Take a look at PyInstaller:

* http://www.pyinstaller.org/
* https://pyinstaller.readthedocs.io/en/stable/

Lutz



More information about the Python-list mailing list