[Python-Dev] Compiling the source without stat

Hrvoje Niksic hrvoje.niksic at avl.com
Thu Dec 15 11:00:06 CET 2011


On 12/14/2011 05:04 PM, Hossein wrote:
> If there is anything I should do

You can determine what the code that calls stat() is trying to do, and 
implement that with other primitives that your platform provides.  For 
example, you can determine whether a file exists by trying to open it in 
read-only mode and checking the error.  You can find whether a 
filesystem path names a directory by trying to chdir into it and 
checking the error.  You can find the size of a regular file by opening 
it and seeking to the end.  These substitutions would not be acceptable 
for a desktop system, but may be perfectly adequate for an embedded one 
that doesn't provide stat() in the first place.  Either way, I expect 
that you will need to modify the sources.

Finally, are you 100% sure that your platform doesn't provide another 
API similar to stat()?


More information about the Python-Dev mailing list