[prev in list] [next in list] [prev in thread] [next in thread] 

List:       py2exe-users
Subject:    Re: [Py2exe-users] exception processing message 0xc0000013
From:       "Thomas Eschenburg" <thomas () eschenburg ! com>
Date:       2009-11-04 11:25:31
Message-ID: 024e01ca5d41$8584c9d0$6803a8c0 () XP3
[Download RAW message or body]

Thanks Mark,

this helped a lot, pointing me to the right solution :-)

Found a good function on
http://stackoverflow.com/questions/851010/how-do-i-check-if-a-disk-is-in-a-d
rive-using-python

import win32api
def testDrive( currentLetter ):
    """
    Tests a given drive letter to see if the drive is question is ready for 
    access. This is to handle things like floppy drives and USB card readers
    which have to have physical media inserted in order to be accessed.
    Returns true if the drive is ready, false if not.
    """
    returnValue = False
    #This prevents Windows from showing an error to the user, and allows
python 
    #to handle the exception on its own.
    oldError = win32api.SetErrorMode( 1 ) #note that SEM_FAILCRITICALERRORS
= 1
    try:
        freeSpace = win32file.GetDiskFreeSpaceEx( letter )
    except:
        returnValue = False
    else:
        returnValue = True
    #restore the Windows error handling state to whatever it was before we
    #started messing with it:
    win32api.SetErrorMode( oldError )
    return returnValue

Regards,
Thomas


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Py2exe-users mailing list
Py2exe-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/py2exe-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic