No space left on device

Chris Liechti cliechti at gmx.net
Wed Feb 20 17:39:23 EST 2002


sag at hydrosphere.com (Sue Giller) wrote in
news:mailman.1014239691.10707.python-list at python.org: 
> 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.
> 
> IOError: [Errno 28] No space left on device: 'c:\\legacystoret\\~

see below in code

> 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)

nono.. there is a cluster size. this space is minimaly allocated for a 
file and all other sizes are rounded up to a multiply of that size.
on a 5GB drive such clusters can be 32k or 64k. you can fill your 
drive with files with no real content....

> 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.

ok so you have space left on that drive..

> 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.

maybe you should consider a database?

note that filling up your system drive can cause many problems such as 
causing strange malfunctions of windows. use a separate partition to 
fill like that.

> # ----- 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)    

is the mktemp module save for such many files? i think it runs out of 
random numbers....
try adding a distinct number like your loopcounter
  fileName = "%d.pck" % (ii) 

>     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
> 
> 



-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list