Neil Cerutti wrote:
I have the following Python program:
import win32com.client
print 'Huh?' # Actually, it says something profain.
Running this program with 2.5.1 causes another Python script in
the same directory to be loaded and run (specifically the import
causes it), and a .pyc file is created from that list.
The 'other' program is called 'new.py'. Is that what's causing
my problem?
A useful technique on these occasions is to use the -v
switch when starting python. If I do nothing more than
import win32com.client , watch what happens:
python -v -c "import win32com.client " 2python-startup.txt
grep "new" python-startup.txt
..
..
# c:\python24\lib \new.pyc matches c:\python24\lib \new.py
import new # precompiled from c:\python24\lib \new.pyc
# cleanup[2] new
So somewhere in there a module called "new" is being
imported from standard library and, yes, you are
shadowing that module by your own one of the same
name.
http://docs.python.org/lib/module-new.html
TJG