Commit 9c682df7d6d1a3e1f22b8cf8e2c896e45b0bb55c
1 parent
838535f8
tablestream: fixed issue #57, bug when importing colorclass 2.x
Showing
1 changed file
with
13 additions
and
2 deletions
oletools/thirdparty/tablestream/tablestream.py
| @@ -42,6 +42,7 @@ License: BSD, see source code or documentation | @@ -42,6 +42,7 @@ License: BSD, see source code or documentation | ||
| 42 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 42 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 43 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 43 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 44 | 44 | ||
| 45 | +from __future__ import print_function | ||
| 45 | 46 | ||
| 46 | #------------------------------------------------------------------------------ | 47 | #------------------------------------------------------------------------------ |
| 47 | # CHANGELOG: | 48 | # CHANGELOG: |
| @@ -49,8 +50,9 @@ License: BSD, see source code or documentation | @@ -49,8 +50,9 @@ License: BSD, see source code or documentation | ||
| 49 | # 2016-01-01 v0.02 PL: - added styles, color support | 50 | # 2016-01-01 v0.02 PL: - added styles, color support |
| 50 | # 2016-04-19 v0.03 PL: - enable colorclass on Windows, fixed issue #39 | 51 | # 2016-04-19 v0.03 PL: - enable colorclass on Windows, fixed issue #39 |
| 51 | # 2016-05-25 v0.04 PL: - updated for colorclass 2.2.0 (now a package) | 52 | # 2016-05-25 v0.04 PL: - updated for colorclass 2.2.0 (now a package) |
| 53 | +# 2016-07-29 v0.05 PL: - fixed oletools issue #57, bug when importing colorclass | ||
| 52 | 54 | ||
| 53 | -__version__ = '0.04' | 55 | +__version__ = '0.05' |
| 54 | 56 | ||
| 55 | #------------------------------------------------------------------------------ | 57 | #------------------------------------------------------------------------------ |
| 56 | # TODO: | 58 | # TODO: |
| @@ -65,7 +67,16 @@ __version__ = '0.04' | @@ -65,7 +67,16 @@ __version__ = '0.04' | ||
| 65 | import textwrap | 67 | import textwrap |
| 66 | import sys, os | 68 | import sys, os |
| 67 | 69 | ||
| 68 | -from thirdparty import colorclass | 70 | +# add the thirdparty subfolder to sys.path (absolute+normalized path): |
| 71 | +_thismodule_dir = os.path.normpath(os.path.abspath(os.path.dirname(__file__))) | ||
| 72 | +# print('_thismodule_dir = %r' % _thismodule_dir) | ||
| 73 | +# assumption: this module is in a subfolder of thirdparty: | ||
| 74 | +_thirdparty_dir = os.path.normpath(os.path.join(_thismodule_dir, '..')) | ||
| 75 | +# print('_thirdparty_dir = %r' % _thirdparty_dir) | ||
| 76 | +if not _thirdparty_dir in sys.path: | ||
| 77 | + sys.path.insert(0, _thirdparty_dir) | ||
| 78 | + | ||
| 79 | +import colorclass | ||
| 69 | 80 | ||
| 70 | # On Windows, colorclass needs to be enabled: | 81 | # On Windows, colorclass needs to be enabled: |
| 71 | if os.name == 'nt': | 82 | if os.name == 'nt': |