[Python-Dev] .pyc broken on Windows -- anywhere else?

Tim Peters tim_one@email.msn.com
Thu, 28 Sep 2000 22:24:24 -0400


This is from 2.0b2 Windows, and typical:

C:\Python20>python -v
# C:\PYTHON20\lib\site.pyc has bad magic
import site # from C:\PYTHON20\lib\site.py
# wrote C:\PYTHON20\lib\site.pyc
# C:\PYTHON20\lib\os.pyc has bad magic
import os # from C:\PYTHON20\lib\os.py
# wrote C:\PYTHON20\lib\os.pyc
import nt # builtin
# C:\PYTHON20\lib\ntpath.pyc has bad magic
import ntpath # from C:\PYTHON20\lib\ntpath.py
# wrote C:\PYTHON20\lib\ntpath.pyc
# C:\PYTHON20\lib\stat.pyc has bad magic
import stat # from C:\PYTHON20\lib\stat.py
# wrote C:\PYTHON20\lib\stat.pyc
# C:\PYTHON20\lib\string.pyc has bad magic
import string # from C:\PYTHON20\lib\string.py
# wrote C:\PYTHON20\lib\string.pyc
import strop # builtin
# C:\PYTHON20\lib\UserDict.pyc has bad magic
import UserDict # from C:\PYTHON20\lib\UserDict.py
# wrote C:\PYTHON20\lib\UserDict.pyc
Python 2.0b2 (#6, Sep 26 2000, 14:59:21) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>>

That is, .pyc's don't work at all anymore on Windows:  Python *always*
thinks they have a bad magic number.  Elsewhere?

Also noticed that test_popen2 got broken on Windows after 2.0b2, for a very
weird reason:

C:\Code\python\dist\src\PCbuild>python ../lib/test/test_popen2.py
Test popen2 module:
testing popen2...
testing popen3...
Traceback (most recent call last):
  File "../lib/test/test_popen2.py", line 64, in ?
    main()
  File "../lib/test/test_popen2.py", line 23, in main
    popen2._test()
  File "c:\code\python\dist\src\lib\popen2.py", line 188, in _test
    for inst in _active[:]:
NameError: There is no variable named '_active'

C:\Code\python\dist\src\PCbuild>

C:\Code\python\dist\src\PCbuild>python ../lib/popen2.py
testing popen2...
testing popen3...
Traceback (most recent call last):
  File "../lib/popen2.py", line 195, in ?
    _test()
  File "../lib/popen2.py", line 188, in _test
    for inst in _active[:]:
NameError: There is no variable named '_active'

C:\Code\python\dist\src\PCbuild>

Ah!  That's probably because of this clever new code:

if sys.platform[:3] == "win":
    # Some things don't make sense on non-Unix platforms.
    del Popen3, Popen4, _active, _cleanup

If I weren't on vacation, I'd check in a fix <wink>.