Loading a module from a subdirectory

Virgil Stokes vs at it.uu.se
Mon Mar 10 21:31:41 CET 2014

I have the following folder-file structure:

                                  +--  __init__.py   (empty file)
                                  +--  GlbVars.py (contains the single 
class Glb)

                                          +--  __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*

   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 
      as expected.

Why does the error occur, and why does it not occur on the Windows Vista 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140310/d454b7f5/attachment.html>

More information about the Python-list mailing list