Foriegn contents in Python Packages...

R

redefined.horizons

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
 
D

Diez B. Roggisch

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,200
Latest member
SCPKatheri

Latest Threads

Top