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

FIX: edge case where module.__file__ is None #1307

Merged
Merged
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
2 changes: 1 addition & 1 deletion src/inspect_ai/_eval/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def wrapper(*w_args: Any, **w_kwargs: Any) -> Task:
# module import, so set its task file and run dir
if get_installed_package_name(task_type) is None:
module = inspect.getmodule(task_type)
if module and hasattr(module, "__file__"):
if module and hasattr(module, "__file__") and module.__file__:
file = Path(getattr(module, "__file__"))
setattr(task_instance, TASK_FILE_ATTR, file.as_posix())
setattr(task_instance, TASK_RUN_DIR_ATTR, file.parent.as_posix())
Expand Down