Commit 32510e060cec18c7e6006a8691f986ac3e326c3f
1 parent
b5149339
xls_parser: fixed import to avoid mixing installed oletools and dev version
Showing
1 changed file
with
12 additions
and
13 deletions
oletools/xls_parser.py
| @@ -5,7 +5,7 @@ Read storages, (sub-)streams, records from xls file | @@ -5,7 +5,7 @@ Read storages, (sub-)streams, records from xls file | ||
| 5 | # | 5 | # |
| 6 | # === LICENSE ================================================================== | 6 | # === LICENSE ================================================================== |
| 7 | 7 | ||
| 8 | -# xls_parser is copyright (c) 2014-2018 Philippe Lagadec (http://www.decalage.info) | 8 | +# xls_parser is copyright (c) 2014-2019 Philippe Lagadec (http://www.decalage.info) |
| 9 | # All rights reserved. | 9 | # All rights reserved. |
| 10 | # | 10 | # |
| 11 | # Redistribution and use in source and binary forms, with or without modification, | 11 | # Redistribution and use in source and binary forms, with or without modification, |
| @@ -33,8 +33,10 @@ Read storages, (sub-)streams, records from xls file | @@ -33,8 +33,10 @@ Read storages, (sub-)streams, records from xls file | ||
| 33 | # 2017-11-02 v0.1 CH: - first version | 33 | # 2017-11-02 v0.1 CH: - first version |
| 34 | # 2017-11-02 v0.2 CH: - move some code to record_base.py | 34 | # 2017-11-02 v0.2 CH: - move some code to record_base.py |
| 35 | # (to avoid copy-and-paste in ppt_parser.py) | 35 | # (to avoid copy-and-paste in ppt_parser.py) |
| 36 | +# 2019-01-30 v0.54dev9 PL: - fixed import to avoid mixing installed oletools | ||
| 37 | +# and dev version | ||
| 36 | 38 | ||
| 37 | -__version__ = '0.2' | 39 | +__version__ = '0.54dev9' |
| 38 | 40 | ||
| 39 | # ----------------------------------------------------------------------------- | 41 | # ----------------------------------------------------------------------------- |
| 40 | # TODO: | 42 | # TODO: |
| @@ -56,17 +58,14 @@ import os.path | @@ -56,17 +58,14 @@ import os.path | ||
| 56 | from struct import unpack | 58 | from struct import unpack |
| 57 | import logging | 59 | import logging |
| 58 | 60 | ||
| 59 | -try: | ||
| 60 | - from oletools import record_base | ||
| 61 | -except ImportError: | ||
| 62 | - # little hack to allow absolute imports even if oletools is not installed. | ||
| 63 | - # Copied from olevba.py | ||
| 64 | - PARENT_DIR = os.path.normpath(os.path.dirname(os.path.dirname( | ||
| 65 | - os.path.abspath(__file__)))) | ||
| 66 | - if PARENT_DIR not in sys.path: | ||
| 67 | - sys.path.insert(0, PARENT_DIR) | ||
| 68 | - del PARENT_DIR | ||
| 69 | - from oletools import record_base | 61 | +# little hack to allow absolute imports even if oletools is not installed. |
| 62 | +# Copied from olevba.py | ||
| 63 | +PARENT_DIR = os.path.normpath(os.path.dirname(os.path.dirname( | ||
| 64 | + os.path.abspath(__file__)))) | ||
| 65 | +if PARENT_DIR not in sys.path: | ||
| 66 | + sys.path.insert(0, PARENT_DIR) | ||
| 67 | +del PARENT_DIR | ||
| 68 | +from oletools import record_base | ||
| 70 | 69 | ||
| 71 | 70 | ||
| 72 | # === PYTHON 2+3 SUPPORT ====================================================== | 71 | # === PYTHON 2+3 SUPPORT ====================================================== |