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

[[Errno 17] File exists: ] # Try create directories that are not part of the archive with #81905

Closed
TalCohen mannequin opened this issue Jul 30, 2019 · 7 comments
Closed
Labels
stdlib Python modules in the Lib dir

Comments

@TalCohen
Copy link
Mannequin

TalCohen mannequin commented Jul 30, 2019

BPO 37724
Nosy @gustaebel, @taleinat, @nanjekyejoannah, @websurfer5, @potomak

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 = None
created_at = <Date 2019-07-30.22:20:23.092>
labels = ['library']
title = '[[Errno 17] File exists: ] # Try create directories that are not part of the archive with'
updated_at = <Date 2020-08-07.05:26:20.931>
user = 'https://bugs.python.org/TalCohen'

bugs.python.org fields:

activity = <Date 2020-08-07.05:26:20.931>
actor = 'Jeffrey.Kintscher'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2019-07-30.22:20:23.092>
creator = 'Tal Cohen'
dependencies = []
files = []
hgrepos = []
issue_num = 37724
keywords = []
message_count = 5.0
messages = ['348772', '348833', '348849', '348912', '373162']
nosy_count = 6.0
nosy_names = ['lars.gustaebel', 'taleinat', 'nanjekyejoannah', 'Jeffrey.Kintscher', 'potomak', 'Tal Cohen']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue37724'
versions = ['Python 2.7']

Linked PRs

@TalCohen TalCohen mannequin added the stdlib Python modules in the Lib dir label Jul 30, 2019
@TalCohen
Copy link
Mannequin Author

TalCohen mannequin commented Jul 30, 2019

_extract_member, raised an exception in case of more than one process, This happens because "not os.path.exists(upperdirs" return True in case of multiprocess

CODE:
.............
if upperdirs and not os.path.exists(upperdirs):
# Create directories that are not part of the archive with
# default permissions.
os.makedirs(upperdirs)
................

I solved the problem by creating the root path before like:
try:
os.makedirs(path)
except OSError as e:
if e.errno != os.errno.EEXIST:
raise
pass

there is an option to add :
if e.errno != os.errno.EEXIST: in your code?

@potomak
Copy link
Mannequin

potomak mannequin commented Aug 1, 2019

There's also the makedirs's exist_ok optional parameter, False by default. You could use it to avoid this error, but I'm not an expert on this particular library, so I'm not sure if it would make sense to make this change.

On a side note, searching for _extract_member, I found a very similar implementation of that function in tarfile.py. In case I think we should apply the same behavior in that module too.

@TalCohen
Copy link
Mannequin Author

TalCohen mannequin commented Aug 1, 2019

Thanks

@taleinat
Copy link
Contributor

taleinat commented Aug 2, 2019

Hi Tal, could you please make your report clearer by giving more context? Right now it is very hard to understand.

The following would be helpful:

  • What are you trying to do that is failing? (perhaps extract a Zip archive?)
  • Which libraries/classes/functions are you using?
  • Can you provide a small sample of code which we can use to reproduce this error ourselves?

@nanjekyejoannah
Copy link
Member

This is marked 2.7 is it still relevant?

@iritkatriel
Copy link
Member

There's been no reply to @taleinat's questions, so I am closing this as abandoned. If there is still a problem, this can be reopened or a new issue created.

@iritkatriel iritkatriel closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2023
@serhiy-storchaka
Copy link
Member

It was a duplicate of #67837.

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
Projects
None yet
Development

No branches or pull requests

4 participants