Ok, but it seems to be working exactly as I need it to right now under
win32. I'll try it on linux. Can you suggest an alternative method?
Or suggest when this won't work?
Thanks,
-Justin
--
http://mail.python.org/mailman/listinfo/python-list
MakaMaka wrote:
> Ok, I figured it out. Thanks for your help guys. If anybody else is
> searching this group looking for the answer, you want the
> sys._getframe() function.
>
> sys._getframe(1).f_locals['a'] = 1
>
> if you put the above in a function in a module, it creates a variable
> 'a' i
Ok, I figured it out. Thanks for your help guys. If anybody else is
searching this group looking for the answer, you want the
sys._getframe() function.
sys._getframe(1).f_locals['a'] = 1
if you put the above in a function in a module, it creates a variable
'a' in the namespace of whatever calls
Steve,
I think I actually need to get the caller's local namespace. How do I
do that using sys? I read the documentation and can't find anything
specific. For example, if I have module A and it imports module B, I
want module B to add variables to A's global namespace. Python has to
store this
MakaMaka wrote:
> Hi again,
> Steve-
> I'm trying to use python to model reliability. Basically, I want to
> read an XML file in that defines a bunch of variables, that are then
> accessible from the python interpreter. For example:
> import reliability
>
> reliability.read_xml("c:\\somefile.xml
Hi again,
Steve-
I'm trying to use python to model reliability. Basically, I want to
read an XML file in that defines a bunch of variables, that are then
accessible from the python interpreter. For example:
import reliability
reliability.read_xml("c:\\somefile.xml") #<== defines x1, x2, x3
resu
MakaMaka wrote:
> I have a scope related question that I haven't been able to find an
> answer to anywhere. Is there a way to have a function in an imported
> module add variables to the scope of the calling script? Basically,
> can I have the following:
>
> #root.py
> import some_module.py
>
MakaMaka wrote:
> Hi,
> I have a scope related question that I haven't been able to find an
> answer to anywhere. Is there a way to have a function in an imported
> module add variables to the scope of the calling script? Basically,
> can I have the following:
>
> #root.py
> import some_module.p