Accessing files in python egg from inside the egg

前端 未结 2 1491
有刺的猬
有刺的猬 2021-02-14 07:49

The question is an attempt to get the exact instruction on how to do that. There were few attempts before, which don\'t seem to be full solutions:

solution to move the f

2条回答
  •  忘掉有多难
    2021-02-14 08:25

    The zipimporter used to load a module can be accessed using the __loader__ attribute on the module, so accessing a file within the egg should be as simple as:

    __loader__.get_data('path/within/the/egg')
    

提交回复
热议问题