Skip to content

Commit

Permalink
handle unmarked path too long errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Jun 25, 2020
1 parent a45f6be commit 2e39a5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit 2e39a5f

Please sign in to comment.