#598 Errors when installing with UAC disabled


If your installation of pywin32 on Windows 7 always end with

close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

This is maybe because you are running Windows under the "Administrator" account and anything you normally run is equal to a "run as Administrator"

And paradoxically running the installation of pywin32 on Windows 7 as Administrator causes this error.

So a workaround is to create another admin account

net user Admin /add
net user Admin <type your password>
net localgroup Administrators Admin /add

and then run the pywin32 installation with

runas /user:Admin pywin32-217.win32-py2.7.exe


  • class101

    class101 - 2012-05-22
    • assigned_to: nobody --> mhammond
  • class101

    class101 - 2012-05-22

    Bug identified and workaround tested working on

    Windows 7, 64-bit, English, main admin account: Administrator
    Windows 7, 64-bit, French, main admin account: Administrateur
    Windows 7, 64-bit, English, main admin account: Admin

  • class101

    class101 - 2012-05-27

    To note that on all of my Windows machines, first things I do is enabling the Administrator account to take ownage of it, and always disabling the UAC

    To me this is urgent to fix this for good mhammond because postscripts seems to generate files and its a bit dangerous to redistribute something that unstable out of the box because the we identify further errors and we have to investigate few hours to finally find out pywin32 was not 100% installed, I had made some research about this issue previously, it seems you applied previous patches for this few years ago, but I'm sorry to inform you 217 is still not stable and fails to install with reproducable cases.

    Also you may be instered to throw out then don't use the Administrator account, I'm working with computer each day this is my work and I notice pywin32 is only or really on of the few product I see failing under the Administrator account and working under a different admin account, but when you know how quircky is the Windows security scheme, its more than evident but definitely not a solution for me to use another Admin account, Windows is just too quircky for this.

  • Mark Hammond

    Mark Hammond - 2012-05-29
    • summary: [solution inside] Windows 7 installation failure --> Errors when installing with UAC disabled
    • status: open --> open-accepted
  • Mark Hammond

    Mark Hammond - 2012-05-29

    I can verify that disabling UAC causes this error when run from an admin account (regardless of that account's name). It looks like the install completes successfully (at least the pywin32_postinstall.log file in the temp dir is complete), but I'll try and dig further into what is causing this error to be shown.


Log in to post a comment.