Accessing data files before and after distutils/setuptools?

I've used a utility method called data_file.

I've used a utility method called data_file: def data_file(fname): """Return the path to a data file of ours. """ return os.path. Join(os.path.

Split(__file__)0, fname) I put this in the init. Py file in my project, and then call it from anywhere in my package to get a file relative to the package. Setuptools offers a similar function, but this doesn't need setuptools.

How will this work when data_files are installed in /usr/share/AppName/themes/ And my executable is in something like /usr/lib/AppName I'd assume... DistUtils documentation says it'll be installed with the sys. Prefix as prefix for the relative path that I gave the data files to be stored in... On *nix systems data files should probably also be in /usr/share/AppName/ – jopsen Aug 2 '09 at 19:58 I've used this with a package_data option in setup.py. Not sure about data_files.

– Ned Batchelder Aug 3 '09 at 3:51 Okay... Yeah, package_data is also an option... Maybe I should go with that... I just don't think it's going to generate Debian compliant packages :) – jopsen Aug 3 '09 at 9:17.

You should use the pkgutil/pkg_resources module to load the data files. It even works from within ziped eggs.

You could try pkg_resources: my_data = pkg_resources. Resource_string(__name__, fname).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions