python-dependency-injector icon indicating copy to clipboard operation
python-dependency-injector copied to clipboard

The yaml config inject does not work in egg (scrapyd)

Open xinatcg opened this issue 1 year ago • 1 comments

we are using the Dependency injector in Scrapy and deploy the egg to scrapyd (by scrapy-client)

the egg already include the yaml config, but base on our test, the yaml config did not load, the env config load successfully.

we are referenced by the multiple container example: https://python-dependency-injector.ets-labs.org/examples/application-multiple-containers.html

class Application(containers.DeclarativeContainer):
config = providers.Configuration(yaml_files=["config.yml"])

we want to try the other way base on the document:

https://python-dependency-injector.ets-labs.org/providers/configuration.html#loading-from-a-yaml-file

application = Application()
application.config.from_yaml("./config.yml")

AttributeError: 'DynamicContainer' object has no attribute 'config'

could you help whether the yaml file config injection support egg?

xinatcg avatar Jul 10 '23 17:07 xinatcg

Base on the Scrapy-client doc about static file include: https://github.com/scrapy/scrapyd-client#including-static-files

is it possible the Dependency-inject yaml file path is not compatible with the egg?

I check the egg files by unzip. the yaml file is located same path with source code

xinatcg avatar Jul 10 '23 17:07 xinatcg