opening a file using a relative path from a subclass in a package

spike grobstein spike.666 at gmail.com
Wed Dec 7 17:24:35 EST 2005


I understand why it wasn't working and it makes sense based on the
structure of namespaces that python defines, however, I'm just
surprised that there isn't some kind of built-in facility for dealing
with these types of things.

Module packages are a spectacular idea, it is just kinda easy to get
confused when you start spaghettifying your imports with multiple
directories and whatnot.

My whole reason for wanting to do this is that I've written a program
that contains a framework for extending the application. It's got a
plugin-like module package framework that allows endusers to add new
functionality, and I'd like it to not only be as trivial as possible to
create new plugins (by simply plugging in values to a new subclass),
but to also repeat as little code as possible (the DRY principal; don't
repeat yourself)

I toyed with the idea of using generic filenames (icon.png,
description.rtf, etc), but ultimately decided against it when I thought
about things I'd want to implement in the future.




More information about the Python-list mailing list