Loading a module from a subdirectory
Automn
automn at willow.org
Fri Jan 23 13:23:36 EST 2015
On 2014-03-10, Virgil Stokes <vs at it.uu.se> wrote:
> This is a multi-part message in MIME format.
> --------------030903060901020503030004
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding: 7bit
>
> I have the following folder-file structure:
>
> C:/PythonCode/VideoPlayerSimulator/
> +-- __init__.py (empty file)
> +-- GlbVars.py (contains the single
> class Glb)
>
> C:/PythonCode/VideoPlayerSimulator/RubberBanding/
> +-- __init__.py
> +-- ImportDemo.py
>
> where, ImportDemo.py contains the following code (a single line):
>
> from VideoPlayerSimulator.GlbVars import Glb as G
>
> gives the following error when I execute it:
>
> *ImportError: No module named VideoPlayerSimulator.GlbVars*
>
> Note:
> 1. My sys.path contains:
> ['C:\\PythonCode\\VideoPlayerSimulator', ...]
> 2. Python 2.7.5 on a Window 7 platform
> 3. The same ImportDemo.py file when executed on my Window Vista platform
> with the same folder-file structure, *DOES NOT* give an error and
> works
> as expected.
>
> Why does the error occur, and why does it not occur on the Windows Vista
> platform?
>
I don't think you understand what Mr. Otten said, it is not undefined behaviour,
maybe you could demangle your import statement.
Automn
More information about the Python-list
mailing list