Skip to content

[BUG] long_callback fails when bundling python code  #1885

@JonThom

Description

@JonThom

Describe your context
Please provide us your environment, so we can easily reproduce the issue.

  • replace the result of pip list | grep dash below
dash                                2.0.0         A Python framework for building reactive web-apps. Developed b...
dash-bootstrap-components           1.0.2         Bootstrap themed components for use in Plotly Dash
dash-core-components                2.0.0         Core component suite for Dash
dash-table                          5.0.0         Dash table

Describe the bug

When using Pyinstaller to bundle a Dash app using long_callback as a single MacOS .app file, the app fails to register the long_callback.
The error occurs in

fn_source = inspect.getsource(fn)

with the call to inspect.getsource, which throws an OSError, stating that the source code cannot be retrieved.
In this case, the long_callback calls external libraries used to query a database.
The error only occurs when packaging with Pyinstaller.
Although the Pyinstaller packaging is probably a fairly rare use case, I was wondering why access to source is needed, and of course whether there might be an obvious workaround.

Expected behavior

Expect the long_callback to register correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions