classification
Title: finding file attributes in Windows seems to fail
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: epaine, musiquegraeme, terry.reedy, vstinner
Priority: normal Keywords:

Created on 2020-09-18 14:24 by musiquegraeme, last changed 2020-09-18 20:41 by terry.reedy. This issue is now closed.

Messages (5)
msg377119 - (view) Author: (musiquegraeme) Date: 2020-09-18 14:24
When I try this in shell 
     os.stat('MyFile2.iso').st_file_attributes
I get a value - 32

When I try this in IDLE 
     print (os.stat('MyFile2.iso').st_file_attributes)

I get the error message.

AttributeError: 'os.stat_result' object has no attribute 'st_file_atributes'
msg377120 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-18 14:27
What is the Python version of IDLE? Try:

>>> import sys; sys.version
'3.8.5 (default, Aug 12 2020, 00:00:00) \n[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)]'
msg377121 - (view) Author: (musiquegraeme) Date: 2020-09-18 14:31
I got 
'3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]'
msg377122 - (view) Author: E. Paine (epaine) * Date: 2020-09-18 14:52
Thank you for reporting this. Please could you double check what you ran because your code says 'st_file_attributes' but the error says 'st_file_atributes' (missing a t in attributes).
msg377138 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-09-18 20:41
I am closing this report because 1) it appears to be a result of a typo; 2) os.stat works fine for me (also on Windows); and 3) I am 99.99% sure that IDLE does not delete user code object attributes.

If a system has two files with the same name in two different directories and one manages to run python twice with the different directories as current directory, so that the same name referred to the two different files, then os.stat might return different values for particular attributes.

But IDLE is not Python.  It is run by some python.exe and it sends user code to the same python.exe for execution (with exec()).  So running code with IDLE cannot delete the attributes of objects created by user code.

(musiquegrame), you can still post the result of checking.
History
Date User Action Args
2020-09-18 20:41:44terry.reedysetstatus: open -> closed
resolution: not a bug
messages: + msg377138

stage: resolved
2020-09-18 14:52:37epainesetnosy: + epaine
messages: + msg377122
2020-09-18 14:31:38musiquegraemesetmessages: + msg377121
2020-09-18 14:27:32vstinnersetnosy: + vstinner
messages: + msg377120
2020-09-18 14:24:22musiquegraemecreate