Menu

#19 os.listdir() fails in HE

open
C++ Side (7)
7
2002-07-25
2002-07-25
Aza Raskin
No

os.listdir() fails to return the correct array in Humane Environment.
Instead of returning ['file1', 'file2', 'file3'] as it would if the function
were called within a normal python environment, it returns ['', '', ''] in
the HE. In other words, it gets the correct number of files, but does
not return their names (hence their paths), which makes the
function useless. Fixing this would be a big help in internal
development (the compile command would not have to use two
ugly hacks, and the commands could be seperated into various
files) and it would probably fix a good number of other bugs.

One of the hacks that was needed for making the compile
command work was to manually enter a timestamp (which I
arbitrarily choose to be 3000000000L), because the actual
timestamp could not be accessed. The two methods for getting a
timestamp, that I am aware of, are:

timestamp = long(os.fstat(f.fileno())[8])
and
timestamp = long(os.stat(file)[8])
where file is a path stored in a string and f is a file object returned
from f = open(file).

This indicates that both the os.fstat and os.stat functions are
broken. Diving into these two functions will probably reveal the
exact problem that is keeping these functions, as well as os.listdir
from working.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB