Error Msg: "The wrong volume is in the drive."

taashlo at sandia.gov taashlo at sandia.gov
Thu Nov 9 22:42:00 CET 2000


Hi all,

I'm using Python 1.5.2 on Windows NT.  I'm trying to split a file
(TmpArcFile) across multiple floppy disks.  The code below works fine
the first time through, it is the second time it runs the
"PrjArcFile = open(PrjArcSerialName, "wb")" line that it opens an
error dialog titled "python.exe" that says "The wrong volume is in the
drive. Please insert volume into A:." and then has 'Abort', 'Retry',
'Ignore' buttons.

I could understand this behavior if the file being written to the
floppy hadn't been closed before the disk change, but it had.

Then it gets really strange because when I hit the 'Retry' button, the
code continues as expected.

Any ideas?

======================
TmpArcFile = open(TmpArcFilename, "rb")
SerialNum = 0;
while 1:  # loop for each disk, until the file is entirely copied.
    PrjArcSerialName = os.path.join(ArchiveDir, ProjectName + "." +
                       string.zfill(`SerialNum`, 3))
    PrjArcFile = open(PrjArcSerialName, "wb")
    while 1: # loop for each file chunk, until the dest disk is full.
        TmpArcFileChunk = TmpArcFile.read(102400)
        if not TmpArcFileChunk: break
        try:
            PrjArcFile.write(TmpArcFileChunk)
        except IOError, (err, perr):
            print "err: " + `err` + " perr: " + perr
            break
    PrjArcFile.close()
    if not TmpArcFileChunk: break
    raw_input("\aInsert another disk.  Press <ENTER> when ready.")
    SerialNum = SerialNum + 1
TmpArcFile.close()
======================

Thanks,
Tad Ashlock <taashlo at sandia.gov>



More information about the Python-list mailing list