newly introduced ilistdir() function

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

newly introduced ilistdir() function

Post by Roberthh » Tue Dec 15, 2015 8:35 am

I have a question about the ilistdir() function. I understand that it returns a list of tuples with (file_name, file_type, inode). When I run that on linux, the inode returned is different from what linux tells with the command ls -l. I simply get sequential numbers, starting at 48879 dec, BEEF hex. Linux is 32 bit mint linux 17.2 (ubuntu variant) in a virtual machine. uos.stat() delivers number consistent with ls -i.
Example:

Code: Select all

>>> [i for i in os.ilistdir()]
[('.', 4, 48879), ('..', 4, 48880), ('.gitignore', 8, 48881), ('alloc.c', 8, 48882), ('build', 4, 48883), ('coverage.c', 8, 48884), ('file.c', 8, 48885), ('gccollect.c', 8, 48886), ('input.c', 8, 48887), ('input.h', 8, 48888), ('main.c', 8, 48889), ('Makefile', 8, 48890), ('micropython', 8, 48891), ('micropython.map', 8, 48892), ('modffi.c', 8, 48893), ('modjni.c', 8, 48894), ('modmachine.c', 8, 48895), ('modos.c', 8, 48896), ('modsocket.c', 8, 48897), ('modtermios.c', 8, 48898), ('modtime.c', 8, 48899), ('moduselect.c', 8, 48900), ('mpconfigport.h', 8, 48901), ('mpconfigport.mk', 8, 48902), ('mpconfigport_fast.h', 8, 48903), ('mpconfigport_minimal.h', 8, 48904), ('mphalport.h', 8, 48905), ('qstrdefsport.h', 8, 48906), ('unix_mphal.c', 8, 48907)]
Update: it seems, that this phenomenon only occurs on folders of the host machine shared with the virtual machine. On real machines and folders local to the virtual machine this does not happen. So it was just an (un)happy draw that I tried this configuration first.

Regards

Post Reply