Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.stat() 's inappropriate behavior when dealing with a broken link in linux systems. #59666

Closed
maliubiaogmailcom mannequin opened this issue Jul 26, 2012 · 3 comments
Closed
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@maliubiaogmailcom
Copy link
Mannequin

maliubiaogmailcom mannequin commented Jul 26, 2012

BPO 15461
Nosy @bitdancer, @hynek

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2012-07-27.02:23:28.138>
created_at = <Date 2012-07-26.21:03:20.481>
labels = ['invalid', 'type-bug', 'library']
title = "os.stat() 's inappropriate behavior when dealing with a broken link in linux systems."
updated_at = <Date 2012-07-27.06:17:19.035>
user = 'https://bugs.python.org/maliubiaogmailcom'

bugs.python.org fields:

activity = <Date 2012-07-27.06:17:19.035>
actor = 'hynek'
assignee = 'none'
closed = True
closed_date = <Date 2012-07-27.02:23:28.138>
closer = 'r.david.murray'
components = ['Library (Lib)']
creation = <Date 2012-07-26.21:03:20.481>
creator = 'maliubiao@gmail.com'
dependencies = []
files = []
hgrepos = []
issue_num = 15461
keywords = []
message_count = 3.0
messages = ['166519', '166533', '166543']
nosy_count = 3.0
nosy_names = ['r.david.murray', 'hynek', 'maliubiao@gmail.com']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue15461'
versions = ['Python 2.7']

@maliubiaogmailcom
Copy link
Mannequin Author

maliubiaogmailcom mannequin commented Jul 26, 2012

the code:
import os,stat
mode=os.stat("a broken link file").st_mode
then i got :OSError: [Errno 2] No such file or directory.

why not just treat a broken link as something existing and don't report any error.

@maliubiaogmailcom maliubiaogmailcom mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jul 26, 2012
@bitdancer
Copy link
Member

Because we are doing what the linux stat call (and command) does . See man stat.

@hynek
Copy link
Member

hynek commented Jul 27, 2012

For the sake of completeness: what you're looking for is os.lstat.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants