8000 _create_tmp_config_dir() "mkdirs" the returned dir by curufinwe · Pull Request #4591 · matplotlib/matplotlib · GitHub 10000
[go: up one dir, main page]

Skip to content

Conversation

@curufinwe
Copy link
Contributor

Fixes #4120

@tacaswell tacaswell added this to the next point release milestone Jul 6, 2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not eat the exception here, this leaves the user in the same situation as before if this fails.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cbook.py already has a safe mkdirs(). Unfortunately, Python's mkdirs() has
some nasty race conditions and other problems, so you should use the safe
mkdirs.
On Jul 6, 2015 12:48 PM, "Thomas A Caswell" notifications@github.com
wrote:

In lib/matplotlib/init.py
#4591 (comment):

@@ -547,6 +548,11 @@ def _create_tmp_config_dir():
tempdir = os.path.join(tempdir, 'matplotlib-%s' % getpass.getuser())
os.environ['MPLCONFIGDIR'] = tempdir

  • try:
  •    mkdirs(tempdir)
    
  • except OSError:

I would not eat the exception here, this leaves the user in the same
situation as before if this fails.


Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/4591/files#r33955250.

@curufinwe
Copy link
Contributor Author

I am using the cbook.py mkdirs.

@tacaswell
Copy link
Member

Thanks for looking into this. I am going to merge this as-is, but I think this needs a more-through overhaul to use temfile.mkdtemp https://docs.python.org/2/library/tempfile.html#tempfile.mkdtemp which will do almost all of this work for us.

tacaswell added a commit that referenced this pull request Jul 7, 2015
FIX: _create_tmp_config_dir() "mkdirs" the returned dir
@tacaswell tacaswell merged commit 906c61e into matplotlib:master Jul 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0