Hanfei Sun
Hanfei Sun

Reputation: 47051

How to implement resource_filename in pkg_resources?

I wrote a package that imports pkg_resource package provided by distribute 0.6.35. I import pkg_resource because I need its resource_filename to get the path of a built-in data. However, the pkg_resource is not built-in in python3 and need to install. About this, I have two questions:

  1. Why Python3 doesn't provide pkg_resource in its official distribution? Does that mean pkg_resource is deprecated or Python3 has an alternative package for pkg_resource built-in?

  2. If Python3 doesn't have alternative package for pkg_resource, how can I write my own version of resource_filename with built-in libraries? Is it easy to do?

Thanks!

Upvotes: 1

Views: 1923

Answers (1)

jfs
jfs

Reputation: 414265

distribute is merged back to setuptools. setuptools supports Python 3.

Upvotes: 1

Related Questions