Skip to content

Commit 811067e

Browse files
committed
make validation conditional in case pdal isn't on the path
1 parent 10e30ac commit 811067e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pdal/pio.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99

1010
import pdal
1111

12-
PDAL_DRIVERS_JSON = subprocess.run(["pdal", "--drivers", "--showjson"], capture_output=True).stdout
13-
PDAL_DRIVERS = json.loads(PDAL_DRIVERS_JSON)
12+
try:
13+
PDAL_DRIVERS_JSON = subprocess.run(["pdal", "--drivers", "--showjson"], capture_output=True).stdout
14+
PDAL_DRIVERS = json.loads(PDAL_DRIVERS_JSON)
15+
_PDAL_VALIDATE = True
16+
except:
17+
PDAL_DRIVERS = []
18+
_PDAL_VALIDATE = False
1419

1520
DEFAULT_STAGE_PARAMS = defaultdict(dict)
1621
DEFAULT_STAGE_PARAMS.update({
@@ -36,7 +41,7 @@ def pipeline(self):
3641
return output
3742

3843
def __getattr__(self, name):
39-
if name not in dir(self):
44+
if _PDAL_VALIDATE and (name not in dir(self)):
4045
raise AttributeError(f"'{self.prefix}.{name}' is an invalid or unsupported PDAL stage")
4146
return partial(self.__class__, self.prefix, type=name)
4247

0 commit comments

Comments
 (0)