Strange __import__() behavior

Terry Reedy tjreedy at udel.edu
Wed Apr 25 17:10:53 EDT 2012


On 4/25/2012 4:05 PM, Frank Miles wrote:
> I have an exceedingly simple function that does a "named import".
> It works perfectly for one file "r"- and fails for the second "x".
>
> If I reverse the order of being called, it is still "x" that fails,
> and "r" still succeeds.
>
> os.access() always reports that the file is readable (i.e. "true")
>
> If I simply call up the python interpreter (python 2.6 - Debian stable)
> and manually "import x" - there is no problem - both work.

sys.path might be different in the two modes. In each, try

import sys; print sys.path

-- 
Terry Jan Reedy




More information about the Python-list mailing list