public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Python and file attributes
@ 2019-07-29  1:12 Steven Penny
  2019-07-29  8:06 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Penny @ 2019-07-29  1:12 UTC (permalink / raw)
  To: cygwin

The Windows version of Python can access file attributes:

    >>> import os
    >>> os.stat('C:\Recovery').st_file_attributes
    8214

https://docs.python.org/library/os#os.stat_result.st_file_attributes

However the Cygwin version cannot:

    >>> import os
    >>> os.stat('C:\Recovery').st_file_attributes
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    AttributeError: 'os.stat_result' object has no attribute
    'st_file_attributes'

This is unexpected as other Cygwin tools can access this information:

    $ lsattr
    -hs------n-- ./Recovery


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Python and file attributes
  2019-07-29  1:12 Python and file attributes Steven Penny
@ 2019-07-29  8:06 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2019-07-29  8:06 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

On Jul 28 18:12, Steven Penny wrote:
> The Windows version of Python can access file attributes:
> 
>    >>> import os
>    >>> os.stat('C:\Recovery').st_file_attributes
>    8214
> 
> https://docs.python.org/library/os#os.stat_result.st_file_attributes
> 
> However the Cygwin version cannot:
> 
>    >>> import os
>    >>> os.stat('C:\Recovery').st_file_attributes
>    Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    AttributeError: 'os.stat_result' object has no attribute
>    'st_file_attributes'
> 
> This is unexpected as other Cygwin tools can access this information:
> 
>    $ lsattr
>    -hs------n-- ./Recovery

No, it's not unexpected.  Attributes are new since Cygwin 3.0 so this
would have required a python rebuild. The Cygwin utilities lsattr/chattr
are very likely the *only* tools being able to access these attributes
at this time.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-29  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29  1:12 Python and file attributes Steven Penny
2019-07-29  8:06 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).