Cameron Walsh wrote:
> Woah, that actually works? Having the "finally" after the "return"?
> That could make some things easier, and some things harder...
The whole point of having a clean-up handler is to make sure it runs no
matter what:
When a return, break or continue statement is exec
Gabriel Genellina wrote:
> At Wednesday 18/10/2006 22:51, Cameron Walsh wrote:
>
>> previous_directory = os.getcwd()
>> try:
>> os.chdir(directory)
>> [ ... ]
>> return modules
>> finally:
>> os.chdir(previous_directory)
>>
>> Woah, that actually works?
At Wednesday 18/10/2006 22:51, Cameron Walsh wrote:
previous_directory = os.getcwd()
try:
os.chdir(directory)
[ ... ]
return modules
finally:
os.chdir(previous_directory)
Woah, that actually works? Having the "finally" after the "return"?
That could
Hi,
This has actually been answered in a previous post ("user modules"
started by myself), for which I was very grateful. I have since
expanded on their solutions to create the following code, of which parts
or all may be useful. You'll probably be most interested in the last
part of the code, f
"Tim Williams" <[EMAIL PROTECTED]> wrote:
>> The import statement expects a name (a symbol), not a string.
>>
>
> eval( 'import %s' % modname)
>
> and
>
> eval( 'reload(%s)' % modname)
>
> Usual warnings about eval apply, but in this case it is usable.
Did you actually try your suggestion be
Tim Williams wrote:
> eval( 'reload(%s)' % modname)
reload takes a module object, not a module name. since you need to have the
object, you might as well pass it to the reload() function.
--
http://mail.python.org/mailman/listinfo/python-list
On 16/10/06, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> Jia Lu wrote:
> > Hi all:
> >
> > I try to do things below:
> import sys
> for i in sys.modules.keys():
> > import i
> > Traceback (most recent call last):
> > File "", line 2, in
> > import i
> > ImportError: No m
Jia Lu wrote:
> Hi all:
>
> I try to do things below:
import sys
for i in sys.modules.keys():
> import i
> Traceback (most recent call last):
> File "", line 2, in
> import i
> ImportError: No module named i
>
> But it seems that import donot know what is i ?
The import s
Christian Joergensen wrote:
> "Jia Lu" <[EMAIL PROTECTED]> writes:
>
>> Hi all:
>>
>> I try to do things below:
> import sys
> for i in sys.modules.keys():
>> import i
>> Traceback (most recent call last):
>> File "", line 2, in
>> import i
>> ImportError: No module named i
>>
"Jia Lu" <[EMAIL PROTECTED]> writes:
> Hi all:
>
> I try to do things below:
import sys
for i in sys.modules.keys():
> import i
> Traceback (most recent call last):
> File "", line 2, in
> import i
> ImportError: No module named i
>
> But it seems that import donot know what
Hi all:
I try to do things below:
>>>import sys
>>> for i in sys.modules.keys():
import i
Traceback (most recent call last):
File "", line 2, in
import i
ImportError: No module named i
But it seems that import donot know what is i ? why?
Thanks/
--
http://mail.python.org/mailman
11 matches
Mail list logo