This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author anonyprog
Recipients anonyprog
Date 2007-10-31.12:43:31
SpamBayes Score 0.31436905
Marked as misclassified No
Message-id <1193834612.62.0.192544402104.issue1367@psf.upfronthosting.co.za>
In-reply-to
Content
Under certain circumstances, creating a directory using os.mkdir then
immediately changing to it using os.chdir fails with a file not found
exception.

Here is some code to demonstrate that. Using the following program with
a parameter of 1 works fine. But anything greater than that and
exceptions occur in the first os.chdir until only one thread is left to
run completely.

Tested on Python 2.5.1 for Windows and Python 2.3.5 for Linux.

    # mkdirtest.py
    #
    # usage: mkdirtest <number of threads>

    import os, threading, sys

    x = int(sys.argv[1])

    class MkdirTest(threading.Thread):

        def __init__(self, t):
            threading.Thread.__init__(self)
            self.t = t
            print "new thread "+str(t)

        def run(self):
            for i in range(0,50):
                s = str(self.t)+"_"+str(i)
                print "mkdir "+s
                os.mkdir(s)
                os.chdir(s)
                os.chdir("..")
            print "end thread "+str(t)

    for t in range(0,x):
        print t
        a = MkdirTest(t)
        a.start()
History
Date User Action Args
2007-10-31 12:43:32anonyprogsetspambayes_score: 0.314369 -> 0.31436905
recipients: + anonyprog
2007-10-31 12:43:32anonyprogsetspambayes_score: 0.314369 -> 0.314369
messageid: <1193834612.62.0.192544402104.issue1367@psf.upfronthosting.co.za>
2007-10-31 12:43:32anonyproglinkissue1367 messages
2007-10-31 12:43:31anonyprogcreate