Is it possible to include source code (.py files)?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to include source code (.py files)?

Craig de Stigter
I've noticed in our app built with pyinstaller, if there are errors the tracebacks are missing the contextual source lines. Additionally if we include breakpoints with `pdb.post_mortem()` or `pdb.set_trace()` there's no way of showing the lines of code, only the line number.

As you can imagine this makes it difficult to debug problems with our app.

Is there any way of including any source .py files in the built app? I couldn't find anything in the documentation about this.

Thanks
Craig de Stigter

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/468d66b3-5be6-499f-b59a-a31f7af6ad7dn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to include source code (.py files)?

bwoodsend

Yes, but it requires #5697 which was released this morning in PyInstaller 4.3. Now if you also add your source files as data files then FrozenImporter.get_source() (and therefore Python’s tracebacks mechanisms) can find them.

For top level code or imports in the same folder as your top level code, it should just be a case of adding --add-data=path/to/file.py:. (Unix) or --add-data=path/to/file.py;. (Windows). (In both cases note the trailing dot.)

To include fully fledged packages containing an __init__.py you’ll likely have abandon the command line and to switch over to the spec file. Edit the .spec file generated by PyInstaller putting from PyInstaller.utils.hooks import collect_data_files at the top then set datas=[] to datas=collect_data_files('foo') (replacing foo with the real name of the library). Then rebuild using pyinstaller specfile-name.spec.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/3558496f-a235-46a9-8181-9ff7bfdac7e8n%40googlegroups.com.