470,647 Members | 1,096 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

Foriegn contents in Python Packages...

Is it possible to store "non-python" files in a directory that serves
as a Python Package? (Like an image file or an XML file.)

Is this allowed for sub-directories that are not Python Packages? In
other words, can I have a Python Package that contains other Python
Packages and also folders that aren't Python Packages?

Thanks,

Scott Huey

Apr 28 '06 #1
1 987
re****************@gmail.com wrote:
Is it possible to store "non-python" files in a directory that serves
as a Python Package? (Like an image file or an XML file.)

Is this allowed for sub-directories that are not Python Packages? In
other words, can I have a Python Package that contains other Python
Packages and also folders that aren't Python Packages?


Yes. And the __file__-attribute of an imported module gives you the location
in the filesystem, so that you can access the contents in a path-agnostic
way.

AFAIK there is even some builtin stuff in setuptools to handle data files -
go google :)

Diez
Apr 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Tim Bradshaw | last post: by
7 posts views Thread by Edward Diener | last post: by
reply views Thread by | last post: by
2 posts views Thread by diffuser78 | last post: by
2 posts views Thread by Gabriel Rossetti | last post: by
1 post views Thread by Martin Rubey | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.