Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dfremont committed Dec 22, 2020
1 parent 782f5ec commit 17cb2c8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/scenic/core/errors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Common exceptions and error handling."""

import importlib
import itertools
import pathlib
import traceback
Expand All @@ -26,7 +27,8 @@
hiddenFolders = [
pathlib.Path(scenic.core.__file__).parent, # scenic.core submodules
pathlib.Path(scenic.syntax.__file__).parent, # scenic.syntax submodules
'<frozen importlib._bootstrap>',
'<frozen importlib._bootstrap>', # parts of importlib used internally
pathlib.Path(importlib.__file__).parent,
]

## Exceptions
Expand Down
1 change: 0 additions & 1 deletion src/scenic/simulators/carla/behaviors.scenic
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Behaviors for dynamic agents in CARLA scenarios."""

from scenic.domains.driving.behaviors import * # use common driving behaviors
import scenic.domains.driving.model as _model

try:
from scenic.simulators.carla.actions import *
Expand Down
7 changes: 5 additions & 2 deletions src/scenic/syntax/veneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,11 @@ def model(namespace, modelName):
try:
loadingModel = True
module = importlib.import_module(modelName)
except ModuleNotFoundError:
raise InvalidScenarioError(f'could not import world model {modelName}') from None
except ModuleNotFoundError as e:
if e.name == modelName:
raise InvalidScenarioError(f'could not import world model {modelName}') from None
else:
raise
finally:
loadingModel = False
names = module.__dict__.get('__all__', None)
Expand Down

0 comments on commit 17cb2c8

Please sign in to comment.