<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 10-Mar-14 21:31, Virgil Stokes
wrote:<br>
</div>
<blockquote cite="mid:531E212D.2080909@it.uu.se" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
I have the following folder-file structure:<br>
<br>
<tt> C:/PythonCode/VideoPlayerSimulator/</tt><tt><br>
</tt><tt> +-- __init__.py
(empty file)</tt><tt><br>
</tt><tt> +-- GlbVars.py
(contains the single class Glb)</tt><tt><br>
</tt><br>
<tt> C:/PythonCode/VideoPlayerSimulator/RubberBanding/</tt><tt><br>
</tt><tt> +-- __init__.py</tt><tt><br>
</tt><tt> +--
ImportDemo.py</tt><br>
<br>
where, <tt>ImportDemo.py</tt> contains the following code (a
single line):<br>
<br>
<tt>from VideoPlayerSimulator.GlbVars import Glb as G</tt><br>
<br>
gives the following error when I execute it:<br>
<br>
<b><tt>ImportError: No module named
VideoPlayerSimulator.GlbVars</tt></b><br>
<br>
<tt> Note:</tt><tt><br>
</tt><tt> 1. My sys.path contains:</tt><tt><br>
</tt><tt> ['C:\\PythonCode\\VideoPlayerSimulator', ...]</tt><tt><br>
</tt><tt> 2. Python 2.7.5 on a Window 7 platform</tt><tt><br>
</tt><tt> 3. The same ImportDemo.py file when executed on my
Window Vista platform<br>
with the same folder-file structure, </tt><tt><b>DOES NOT</b>
give an error and works <br>
as expected.</tt><tt><br>
<br>
Why does the error occur, and why does it not occur on the
Windows Vista platform?<br>
</tt><br>
</blockquote>
After searching for more on this topic I found that the following
did work on Windows 7:<br>
<br>
<tt>import imp</tt><br>
<tt>G = imp.load_source('foo',
'C:/PythonCode/VideoPlayerSimulator/GlbVars.py').Glb</tt><br>
<br>
But, I am still unable to determine why my first method does not
work on Window 7.<br>
</body>
</html>