indygreg / indygreg/PyOxidizer

Dash: FileNotFoundError: [Errno 2] resource not known

Open
#533 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

I'm using PyOxidizer to create a dash app. Using the following starlark configuration enables successfull compiling:

```
def make_exe():
dist = default_python_distribution()
policy = dist.make_python_packaging_policy()

policy.allow_files = True
policy.include_test = False
policy.resources_location = "in-memory"
policy.resources_location_fallback = "filesystem-relative:deps"

python_config = dist.make_python_interpreter_config()

python_config.module_search_paths = ["$ORIGIN/lib"]
python_config.run_module = "dashApp"

exe = dist.to_python_executable(
name="GHdash",

packaging_policy=policy,
config=python_config,
)

modules = ["dash", "pymongo", "pandas"]

for resource in exe.pip_download(modules):
resource.add_location = "filesystem-relative:deps"

resource.add_source = True
exe.add_python_resource(resource)

exe.add_python_resources(exe.read_package_root(
path=CWD,
packages=["fcRepair", "dashApp", "DBinterface"],
))

return exe

def make_embedded_resources(exe):
return exe.to_embedded_resources()

def make_install(exe):
files = FileManifest()
files.add_python_resource(".", exe)

return files

def make_msi(exe):
return exe.to_wix_msi_builder(
"GHdash",
"GreenHeater DashBoard",
"1.0",
"SKittan"
)

def register_code_signers():
if not VARS.get("ENABLE_CODE_SIGNING"):
return

register_code_signers()

register_target("exe", make_exe)
register_target("resources", make_embedded_resources, depends=["exe"], default_build_script=True)
register_target("install", make_install, depends=["exe"], default=True)
register_target("msi_installer", make_msi, depends=["exe"])

resolve_targets()
```

The underlying flask server can be started by the compiled exe. But when a connection is established nothing happens, since the dash resource files cannot be found by the program. I checked all resource files, they are present. Hence I think there is a problem with the oxidized importer to classify the dash resources.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Starlark configuration and reproduce the compiled Dash application behavior, checking resource lookup when a connection is established. Compare the packaged resource locations with the oxidized importer's runtime resolution. Done means the compiled executable can locate and serve the Dash resource files.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.