Commit 5699d8bf95971b242778265938920cc32221a9de

Authored by decalage2
1 parent 13eb7056

olevba3: import io instead of _io

Showing 1 changed file with 9 additions and 3 deletions
oletools/olevba3.py
@@ -79,7 +79,6 @@ https://github.com/unixfreak0037/officeparser @@ -79,7 +79,6 @@ https://github.com/unixfreak0037/officeparser
79 79
80 from __future__ import print_function 80 from __future__ import print_function
81 81
82 -  
83 #------------------------------------------------------------------------------ 82 #------------------------------------------------------------------------------
84 # CHANGELOG: 83 # CHANGELOG:
85 # 2014-08-05 v0.01 PL: - first version based on officeparser code 84 # 2014-08-05 v0.01 PL: - first version based on officeparser code
@@ -248,7 +247,7 @@ import sys @@ -248,7 +247,7 @@ import sys
248 import os 247 import os
249 import logging 248 import logging
250 import struct 249 import struct
251 -from _io import StringIO,BytesIO 250 +from io import BytesIO
252 import math 251 import math
253 import zipfile 252 import zipfile
254 import re 253 import re
@@ -259,7 +258,6 @@ import zlib @@ -259,7 +258,6 @@ import zlib
259 import email # for MHTML parsing 258 import email # for MHTML parsing
260 import string # for printable 259 import string # for printable
261 import json # for json output mode (argument --json) 260 import json # for json output mode (argument --json)
262 -from functools import reduce  
263 261
264 # import lxml or ElementTree for XML parsing: 262 # import lxml or ElementTree for XML parsing:
265 try: 263 try:
@@ -278,6 +276,13 @@ except ImportError: @@ -278,6 +276,13 @@ except ImportError:
278 + "see http://codespeak.net/lxml " \ 276 + "see http://codespeak.net/lxml " \
279 + "or http://effbot.org/zone/element-index.htm") 277 + "or http://effbot.org/zone/element-index.htm")
280 278
  279 +import colorclass
  280 +
  281 +# On Windows, colorclass needs to be enabled:
  282 +if os.name == 'nt':
  283 + colorclass.Windows.enable(auto_colors=True)
  284 +
  285 +
281 # IMPORTANT: it should be possible to run oletools directly as scripts 286 # IMPORTANT: it should be possible to run oletools directly as scripts
282 # in any directory without installing them with pip or setup.py. 287 # in any directory without installing them with pip or setup.py.
283 # In that case, relative imports are NOT usable. 288 # In that case, relative imports are NOT usable.
@@ -324,6 +329,7 @@ else: @@ -324,6 +329,7 @@ else:
324 from zipfile import is_zipfile 329 from zipfile import is_zipfile
325 # xrange is now called range: 330 # xrange is now called range:
326 xrange = range 331 xrange = range
  332 + from functools import reduce
327 333
328 334
329 # === PYTHON 3.0 - 3.4 SUPPORT ====================================================== 335 # === PYTHON 3.0 - 3.4 SUPPORT ======================================================