[Python-bugs-list] [ python-Bugs-779191 ] BasicModuleLoader behaviour in Python 2.3c2

SourceForge.net noreply@sourceforge.net
Mon, 28 Jul 2003 15:32:07 -0700


Bugs item #779191, was opened at 2003-07-28 22:32
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=779191&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Selim Tuvi (stuvi)
Assigned to: Nobody/Anonymous (nobody)
Summary: BasicModuleLoader behaviour in Python 2.3c2

Initial Comment:
Hi I am using the BasicModuleLoader class from the 
ihooks module and noticed that it behaves differently 
based on whether it is used from a script vs. from the 
Python command line. Here is the transcript of my 
session:

C:\projects\Online\repos>type testModule.py


C:\projects\Online\repos>cd ..\testsuite

C:\projects\Online\testsuite>type impTest.py
from ihooks import BasicModuleLoader
import os
os.chdir('../repos')
ml = BasicModuleLoader()
modstuff = ml.find_module('testModule')
print modstuff

C:\projects\Online\testsuite>python impTest.py
None

C:\projects\Online\testsuite>python
Python 2.3c2 (#45, Jul 24 2003, 21:23:54) [MSC v.1200 
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more 
information.
>>> from ihooks import BasicModuleLoader
>>> import os
>>> os.chdir('../repos')
>>> ml = BasicModuleLoader()
>>> modstuff = ml.find_module('testModule')
>>> print modstuff
(<open file 'testModule.py', mode 'U' at 
0x008E8F20>, 'testModule.py', ('.py', '
U', 1))
>>> ^Z


C:\projects\Online\testsuite>cd ..\repos

C:\projects\Online\repos>python ..\testsuite\impTest.py
(<open file 'C:\projects\Online\repos\testModule.py', 
mode 'U' at 0x008E7F20>, '
C:\projects\Online\repos\testModule.py', ('.py', 'U', 
1))

C:\projects\Online\repos>

Explanation of the above session:
I created an empty module called testModule.py and 
stored it in c:\projects\Online\repos. Then I wrote the 
impTest.py script that tries to import it through the 
BasicModuleLoader. The impTest.py script resides in 
c:\projects\Online\testsuite directory. If I run the script 
from the testsuite directory it fails to find the module. If 
while I am in the testsuite directory I enter the contents 
of the impTest.py using the Python command line then it 
finds the module. Also if I run the impTest.py while I am 
in the repos directory then it finds it as well. In Python 
2.2 this had worked in every case.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=779191&group_id=5470