Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Workaround for Python not finding imports in spawned processes (#4630)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkgr committed Sep 8, 2020
1 parent dcc9cdc commit bf3206a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions allennlp/common/plugins.py
Expand Up @@ -10,6 +10,7 @@
import importlib
import logging
import os
import sys
from typing import Iterable

from allennlp.common.util import push_python_path, import_module_and_submodules
Expand Down Expand Up @@ -46,6 +47,12 @@ def import_plugins() -> None:
"""
Imports the plugins found with `discover_plugins()`.
"""

# Workaround for a presumed Python issue where spawned processes can't find modules in the current directory.
cwd = os.getcwd()
if cwd not in sys.path:
sys.path.append(cwd)

for module_name in DEFAULT_PLUGINS:
try:
# For default plugins we recursively import everything.
Expand Down

0 comments on commit bf3206a

Please sign in to comment.