Dynamic package exploration
Sebastien Pierre
spierre at rational.com
Fri Jul 21 18:24:58 EDT 2000
Hi !
I'm having a strange problem with Python :
I cannot reference any Python object using an absolute name...
Example :
>>print os.name
fails....
But if I do
>>import os
>>print os.name
It works - so I guess you have to "import" first before being able to
reference anything.
But if I do :
>>eval ( "import os" )
It doesn't work...so it prevents me from doing something
dynamic...Ouch!
The point is that I want to dynamically load a set of extensions that
belong to a specific package.
Let's say I have a package A that contains 10 python files. What I want
to do is dynamically inspect the content of A (the 10 python files), and
check if those python files have the attribute called
'__my_attribute__'. Then I want to register these attributes in a list.
Is it possible ?
Thanks,
Seb.
--
Sebastien Pierre.- spierre at rational.com \
R a t i o n a l software | XML \ If you like classical music,
. Rational Unified Process | technology \ feel free to visit
. Vancouver, B.C, -Canada | intern \ <www.costes.org>
More information about the Python-list
mailing list