Cannot execute Windows commands via Python in 64-bit

Tim Roberts timr at probo.com
Sat May 5 18:40:21 EDT 2007


minitotoro <nsjmetzger at gmail.com> wrote:
>
>Upon further investigation it turned out to be a windohs 64-bit issue
>(which is what I was afraid of). I did however find an asinine work
>around.
>
>Make a copy of defrag.exe from the system32 folder and paste it in the
>same directory as the python script. Voila! It now works. Piece of
>junk windohs... :-S

If you are using a 32-bit Python, then all references you make to
\windows\system32 are automatically rewritten to \windows\syswow64.  If
defrag.exe is not present in \windows\syswow64, that could explain it.

Unbelievable but true.  Although we were all smart enough to handle the
transition from \windows\system in Win16 to \windows\system32 in Win32,
Microsoft apparently believes programmers have all grown too stupid to
handle the transition to Win64 on our own.

Some registry references are also silently rewritten.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list