import mysteries

David Abrahams dave at boost-consulting.com
Thu Jul 5 05:47:18 CEST 2007


on Wed Jul 04 2007, Peter Otten <__peter__-AT-web.de> wrote:

>>> Explicitly passed, see
>>>
>>>
> http://genshi.edgewall.org/browser/trunk/genshi/filters/tests/transform.py
>> 
>> IIRC I ran doctest on the file I cited, not the one you're pointing
>> at.  Is there some new magic doctest feature I should know about?
>
> Had you looked at it 

Gimme a little credit, please!  Of course I looked at it.

> you'd seen that the file I pointed to is the driver
> script for running the doctests in the file you pointed to 

Yes, I saw that, but I don't know of any magic feature that causes the
driver script to get loaded when I invoke doctest directly on the file
I pointed to.

> -- unfortunately they have the same name. [...]/tests/transform.py
> does indeed inject a HTML object into the globals of
> [...]/filters/transform.py before it runs the tests.

Yes, I saw that, but as I said...

Anyway, maybe I just got confused and doctest-ed the driver script.
That certainly would explain everything.

>>>> Another example: I was recently working on some code that did an
>>>> import from inside a class method.  That import was failing.  I moved
>>>> the import to the top of the file (at module scope) and it succeeded.
>>>> I'm fairly sure that nobody was monkeying around with sys.path in that
>>>> case.  Can anyone think of a likely explanation?
>>>
>>> Too vague, sorry.
>> 
>>   # this will succeed if I do it here
>>   # import foo.bar
>> 
>>   class X:
>>         def y():
>>             import foo.bar # but this fails
>  
> Are threads involved? I vaguely remember a problem with Queue.Queue that
> came up on this list some time ago.

I don't know, honestly.  This was probably in Trac somewhere.  I don't
know if it's threaded.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

The Astoria Seminar ==> http://www.astoriaseminar.com




More information about the Python-list mailing list