indygreg / indygreg/PyOxidizer

package does not exist; excluding resources

Open
#71 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I'm trying to convert pytz to use "proper" Python resources (see fork here, https://github.com/stub42/pytz/compare/master...ipmb:resource-loader) and having issues getting them picked up in pyoxidizer. If I install my package into a virtualenv and run with Python, it works as expected:

```
>>> import importlib.resources
>>> importlib.resources.read_binary("pytz.zoneinfo.Africa", "Accra")
b'TZif2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\...
```

When I build the pyoxidizer binary, I see these warnings:

```
package pytz.zoneinfo.Africa does not exist; excluding resources: ["Abidjan", "Accra", "Addis_Ababa", "Algiers", "Asmara", "Asmera", "Bamako", "Bangui", "Banjul", "Bissau", "Blantyre", "Brazzaville", "Bujumbura", "Cairo", "Casablanca", "Ceuta", "Conakry", "Dakar", "Dar_es_Salaam", "Djibouti", "Douala", "El_Aaiun", "Freetown", "Gaborone", "Harare", "Johannesburg", "Juba", "Kampala", "Khartoum", "Kigali", "Kinshasa", "Lagos", "Libreville", "Lome", "Luanda", "Lubumbashi", "Lusaka", "Malabo", "Maputo", "Maseru", "Mbabane", "Mogadishu", "Monrovia", "Nairobi", "Ndjamena", "Niamey", "Nouakchott", "Ouagadougou", "Porto-Novo", "Sao_Tome", "Timbuktu", "Tripoli", "Tunis", "Windhoek"]
```

...and trying to run the binary, I get:

```
File "pytz", line 1115, in
File "pytz.lazy", line 101, in _lazy
File "pytz", line 1112, in
File "pytz", line 128, in resource_exists
File "pytz", line 106, in open_resource
File "importlib.resources", line 88, in open_binary
File "importlib.resources", line 49, in _get_package
TypeError: 'pytz.zoneinfo.Africa' is not a package
```

I'm using pyoxidizer version 0.2.0

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

Reproduce the failure with pytz, importlib.resources.read_binary("pytz.zoneinfo.Africa", "Accra"), and PyOxidizer 0.2.0. Start by tracing PyOxidizer's package resource discovery for pytz.zoneinfo.Africa and compare it with the virtualenv behavior. Done means the package is recognized, its zoneinfo resources are included, and the built binary runs without the TypeError.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.