Title: `FileExistsError` error when `psyplot` is imported from multiple parallel processes · Issue #52 · psyplot/psyplot · GitHub
Open Graph Title: `FileExistsError` error when `psyplot` is imported from multiple parallel processes · Issue #52 · psyplot/psyplot
X Title: `FileExistsError` error when `psyplot` is imported from multiple parallel processes · Issue #52 · psyplot/psyplot
Description: Hello! First of all, thanks for this great package!! Problem description We (the ESMValTool community) found an issue when importing psyplot from different parallel processes in a test environment, which leads to a race condition where t...
Open Graph Description: Hello! First of all, thanks for this great package!! Problem description We (the ESMValTool community) found an issue when importing psyplot from different parallel processes in a test environment,...
X Description: Hello! First of all, thanks for this great package!! Problem description We (the ESMValTool community) found an issue when importing psyplot from different parallel processes in a test environment,...
Opengraph URL: https://github.com/psyplot/psyplot/issues/52
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`FileExistsError` error when `psyplot` is imported from multiple parallel processes","articleBody":"Hello!\r\n\r\nFirst of all, thanks for this great package!!\r\n\r\n#### Problem description\r\n\r\nWe (the [ESMValTool](https://github.com/ESMValGroup/ESMValTool) community) found an issue when importing `psyplot` from different parallel processes in a test environment, which leads to a race condition where the package finds that it has no config file and tries to create that, but two processes try that at the same time, resulting in a `FileExistsError: [Errno 17] File exists: '/Users/runner/.config/psyplot'`. Note that we only found this behavior for OSX.\r\n\r\n#### Code Sample, a copy-pastable example if possible\r\n\r\nAn error on our CI machine using the import below is given [here](https://github.com/ESMValGroup/ESMValTool/runs/6470528634?check_suite_focus=true),\r\n\r\n```python\r\nfrom psyplot.config.logsetup import _get_home\r\n```\r\n\r\nbut we also found the [same problem](https://github.com/ESMValGroup/ESMValTool/runs/6462593093?check_suite_focus=true#step:7:50) when using\r\n\r\n```python\r\nimport psyplot.project as psy\r\n```\r\n\r\nPlease note that due to the race condition, the error cannot be reproduced consistently.\r\n\r\n#### Expected Output\r\n\r\nNo error and no race condition.\r\n\r\n#### Full error message\r\n\r\n\u003cdetails\u003e\r\n\r\n```bash\r\n tests/unit/test_platform.py:4: in \u003cmodule\u003e\r\n from psyplot.config.logsetup import _get_home\r\n../../../miniconda3/envs/esmvaltool/lib/python3.9/site-packages/psyplot/__init__.py:30: in \u003cmodule\u003e\r\n from psyplot.config.rcsetup import rcParams\r\n../../../miniconda3/envs/esmvaltool/lib/python3.9/site-packages/psyplot/config/__init__.py:42: in \u003cmodule\u003e\r\n config_path = psyplot_fname()\r\n../../../miniconda3/envs/esmvaltool/lib/python3.9/site-packages/psyplot/config/rcsetup.py:978: in psyplot_fname\r\n configdir = get_configdir()\r\n../../../miniconda3/envs/esmvaltool/lib/python3.9/site-packages/psyplot/config/rcsetup.py:1028: in get_configdir\r\n os.makedirs(p)\r\n../../../miniconda3/envs/esmvaltool/lib/python3.9/os.py:225: in makedirs\r\n mkdir(name, mode)\r\nE FileExistsError: [Errno 17] File exists: '/Users/runner/.config/psyplot'\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n#### Output of ``psyplot -aV``\r\n\r\n\u003cdetails\u003e\r\n\r\n```\r\npsyplot:\r\n requirements:\r\n matplotlib: 3.5.2\r\n numpy: 1.22.3\r\n pandas: 1.4.2\r\n python: 3.8.13 | packaged by conda-forge\r\n xarray: 2022.3.0\r\n version: 1.4.2\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n#### NOTE\r\nThis is a bug report.\r\n\r\nFor requesting new features, use [this template](https://github.com/psyplot/psyplot/issues/new?template=new_feature.md\u0026title=NEW+FEATURE:).\r\n\r\nFor changing existing features, use [this template](https://github.com/psyplot/psyplot/issues/new?template=change_feature.md\u0026title=CHANGE+FEATURE:).\r\n","author":{"url":"https://github.com/schlunma","@type":"Person","name":"schlunma"},"datePublished":"2022-05-17T14:46:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/52/psyplot/issues/52"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:71caf09b-a633-0aa1-b5f5-cbe3814b714d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D822:1273CB:E84C43:13D5C27:698DC2BC |
| html-safe-nonce | 9ad64a0b0f4cd3fcb40e504c2c4f189c05f84472c90e736a03fba554cd33c5f3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODIyOjEyNzNDQjpFODRDNDM6MTNENUMyNzo2OThEQzJCQyIsInZpc2l0b3JfaWQiOiI4MTIxMTQ0MDA3MjQzNzExMTY0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 843ce0f1803876d4761b25c25681b06602c052163ea496a8d72197d7f62e7a05 |
| hovercard-subject-tag | issue:1238756654 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/psyplot/psyplot/52/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c2391c26d100a1be49441a515dff7f018ad73b0120a7b1d9d7933236eea46faf/psyplot/psyplot/issues/52 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c2391c26d100a1be49441a515dff7f018ad73b0120a7b1d9d7933236eea46faf/psyplot/psyplot/issues/52 |
| og:image:alt | Hello! First of all, thanks for this great package!! Problem description We (the ESMValTool community) found an issue when importing psyplot from different parallel processes in a test environment,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | schlunma |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2457fd9a1b17ca7f38c3c2653895ccb2e0dd04f18f77446a21354e9bc4b7902f |
| turbo-cache-control | no-preview |
| go-import | github.com/psyplot/psyplot git https://github.com/psyplot/psyplot.git |
| octolytics-dimension-user_id | 60222268 |
| octolytics-dimension-user_login | psyplot |
| octolytics-dimension-repository_id | 87944102 |
| octolytics-dimension-repository_nwo | psyplot/psyplot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 87944102 |
| octolytics-dimension-repository_network_root_nwo | psyplot/psyplot |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 878672b82363fd98fbdc5bd0edb68e572c8a8d9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width