Loading a module from a subdirectory

V

Virgil Stokes

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top