[Tutor] file.write() blocking

Jonathan Hayward jsh47 at cam.ac.uk
Wed Mar 24 08:46:08 EST 2004


    def save_entry(self, text, filename):
        debug_log("Reached 1")
        debug_log(DOCUMENT_ROOT + "entries/" + filename)
        output_file = file(DOCUMENT_ROOT + "entries/" + filename, "w")
        debug_log("Reached 2")
        #debug_log(text)
        file.write("")
        debug_log("Reached 2.5")
        file.write(text)
        debug_log("Reached 3")
        file.close()
        debug_log("Reached 4")

When I get to this point in my code, it prints, "Reached 2" and hangs on 
file.write(""). The output directory has a zero-byte file created. When 
I try analogous test code from Python interactively, it works; does 
anyone see the glitch in this? (The text is a small webpage.)

-- 
++ Jonathan Hayward, jonathan.hayward at pobox.com
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com





More information about the Tutor mailing list