Skip to content

Commit

Permalink
Fix path list in error
Browse files Browse the repository at this point in the history
`prospector --profile inexisting` war returning
```
Failed to run:
Could not find profile 111.
Search path: [:P:o:s:i:x:P:a:t:h:(:':/:h:o:m:e:/:s:b:r:u:n:n:e:r:/:w:o:r:k:s:p:a:c:e:/:p:r:o:s:p:e:c:t:o:r:':):,: :P:o:s:i:x:P:a:t:h:(:':/:h:o:m:e:/:s:b:r:u:n:n:e:r:/:w:o:r:k:s:p:a:c:e:/:p:r:o:s:p:e:c:t:o:r:/:p:r:o:s:p:e:c:t:o:r:/:p:r:o:f:i:l:e:s:/:p:r:o:f:i:l:e:s:':):], or in module 'prospector_profile_inexisting'
```
  • Loading branch information
sbrunner committed Oct 25, 2024
1 parent bab605b commit bd1622c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions prospector/profiles/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from pathlib import Path


class ProfileNotFound(Exception):
def __init__(self, name: str, profile_path: str) -> None:
def __init__(self, name: str, profile_path: list[Path]) -> None:
super().__init__()
self.name = name
self.profile_path = profile_path

def __repr__(self) -> str:
return "Could not find profile {}; searched in {}".format(
self.name,
":".join(self.profile_path),
":".join(map(str, self.profile_path)),
)


Expand Down
2 changes: 1 addition & 1 deletion prospector/profiles/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def _load_content(name_or_path: Union[str, Path], profile_path: list[Path]) -> d
if optional:
return {}

raise ProfileNotFound(str(name_or_path), str(profile_path))
raise ProfileNotFound(str(name_or_path), profile_path)

with codecs.open(filename) as fct:
try:
Expand Down

0 comments on commit bd1622c

Please sign in to comment.