Commit bda20c7be21decd0983d2e0c6a423fce19b71674

Authored by Christian Herdtweck
1 parent 3e29e361

msodde: copy absolute import hack from olevba

Showing 1 changed file with 7 additions and 0 deletions
oletools/msodde.py
@@ -78,6 +78,13 @@ import sys @@ -78,6 +78,13 @@ import sys
78 import json 78 import json
79 import logging 79 import logging
80 80
  81 +# little hack to allow absolute imports even if oletools is not installed
  82 +# Copied from olevba.py
  83 +_thismodule_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
  84 +_parent_dir = os.path.normpath(os.path.join(_thismodule_dir, '..'))
  85 +if not _parent_dir in sys.path:
  86 + sys.path.insert(0, _parent_dir)
  87 +
81 from oletools.thirdparty import olefile 88 from oletools.thirdparty import olefile
82 89
83 # === PYTHON 2+3 SUPPORT ====================================================== 90 # === PYTHON 2+3 SUPPORT ======================================================