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

More windows path lengths #2591

Merged
merged 1 commit into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

### Fixes
- dbt config-version: 2 now properly defers rendering `+pre-hook` and `+post-hook` fields. ([#2583](https:/fishtown-analytics/dbt/issues/2583), [#2854](https:/fishtown-analytics/dbt/pull/2854))
- dbt handles too-long paths on windows that do not report that the path is too long ([#2591](https:/fishtown-analytics/dbt/pull/2591))


## dbt 0.17.1rc1 (June 19, 2020)
Expand Down
11 changes: 9 additions & 2 deletions core/dbt/clients/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,20 @@ def write_file(path: str, contents: str = '') -> bool:
except FileNotFoundError as exc:
if (
os.name == 'nt' and
getattr(exc, 'winerror', 0) == 3 and
len(path) >= 260
):
# sometimes we get a winerror of 3 which means the path was
# definitely too long, but other times we don't and it means the
# path was just probably too long. This is probably based on the
# windows/python version.
if getattr(exc, 'winerror', 0) == 3:
reason = 'Path was too long'
else:
reason = 'Path was possibly too long'
# all our hard work and the path was still too long. Log and
# continue.
logger.debug(
f'Could not write to path {path}: Path was too long '
f'Could not write to path {path}: {reason} '
f'({len(path)} characters)'
)
else:
Expand Down