[mod_python] os.listdir()

Graham Dumpleton grahamd at dscpl.com.au
Wed Mar 23 23:34:22 EST 2005


Post the code which uses the result of calling os.listdir("/tmp").

If you are using mod_python.publisher, what do get if a publisher
function is written as:

  def function():
    return os.listdir("/tmp")

Does the list of files correctly display on the browser?

If you are trying to display the result yourself in some way in a HTML
page, are you passing each file name through cgi.escape() to ensure that
no special characters in the names are stuffing up the HTML when parsed
by the browser?

Graham

William Chan wrote ..
> Hi,
> 
>    I'm using mod_python. os.listdir('/tmp') in a request handler
> returns a list of empty strings (note: the number of empty strings is
> the same as the number of elements in /tmp). I am sure that I can
> access the filesystem in request handlers since os.stat('/tmp').st_ino
> returns the correct inode number. Any idea what may go wrong?
> 
> Thanks,
> William
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python


More information about the Mod_python mailing list