No space left on device

Sue Giller sag at hydrosphere.com
Wed Feb 20 16:17:29 EST 2002


I am hoping someone here can give me some insight.

I have a program that generates a LOT of small files in a 
Windows2000 subdirectory.  It is my understanding (often faulty) 
that there is no limit to the number of files such a subdirectory can 
contain.  However, I am getting an error when I hit about 21,843 
files.

  File "C:\Python21\Scripts\Tests\ManyFiles.py", line 14, in ?
    fp = open(fileName, 'wb')
IOError: [Errno 28] No space left on device: 'c:\\legacystoret\\~916-
22850tst.pck'

I have over 5 G of space on the drive, and the test files are 0 len 
anyway.  (It still happens if the files are not 0 len)

I can then create additional files in that directory from within a DOS 
window, but I cannot rerun my file generator to make even one more 
file.   So I am wondering if the limit comes from Windows, from 
Python 'open...' or some other innards of Python.

I'm hoping someone can shed some light as to where this error is 
coming from.  I am hoping I don't have to totally change my file-
generating system to lessen the number of files, since 22,000 is just 
a start on the count I may need.

TIA

I have reduced the code to the following simple case. 

# ----- CODE -----
# manyFiles - generate many files with temp names to see if we 
reach a limit

import tempfile

maxFileCount = 100000           # fails at about 21,843 files
seed = 'tst'                              # base for generated filenames
base = r'c:\\storetlegacy'		# dir that gets the files

for ii in xrange(maxFileCount):
    tempfile.tempdir = base
    temp = tempfile.mktemp(seed)
    fileName = "%s.pck" % (temp)    
    fp = open(fileName, 'wb')	# error comes here
    fp.close()
    if ii % 50 == 0:
        print "filecount", ii			# kekep track of how far we are 
along the count




More information about the Python-list mailing list