diff --git a/libcnmc/cir_4_2015/F9.py b/libcnmc/cir_4_2015/F9.py index e0b3c5d3..e10a5c57 100644 --- a/libcnmc/cir_4_2015/F9.py +++ b/libcnmc/cir_4_2015/F9.py @@ -4,10 +4,7 @@ from libcnmc.core import StopMultiprocessBased from libcnmc.utils import get_srid, convert_srid, format_f, parse_geom -try: - from cStringIO import StringIO -except: - from StringIO import StringIO +from io import BytesIO class F9(StopMultiprocessBased): @@ -229,7 +226,7 @@ def writer(self): if self.file_output: fio = open(self.file_output, 'wb') else: - fio = StringIO() + fio = BytesIO() while True: try: item = self.output_q.get() @@ -257,7 +254,7 @@ def writer(self): if self.file_modificaciones: fio_mod = open(self.file_modificaciones, 'wb') else: - fio_mod = StringIO() + fio_mod = BytesIO() while True: try: diff --git a/libcnmc/core/__init__.py b/libcnmc/core/__init__.py index 2bcaa587..897e918a 100644 --- a/libcnmc/core/__init__.py +++ b/libcnmc/core/__init__.py @@ -4,10 +4,7 @@ import os import sys from datetime import datetime -try: - from cStringIO import StringIO -except: - from StringIO import StringIO +from io import BytesIO import traceback try: @@ -141,7 +138,7 @@ def writer(self): if self.file_output: fio = open(self.file_output, 'wb') else: - fio = StringIO() + fio = BytesIO() fitxer = csv.writer(fio, delimiter=';', lineterminator='\n') if self.file_header: fitxer.writerow(self.file_header) @@ -170,7 +167,7 @@ def writer_mod(self): if self.file_modificaciones: fio_mod = open(self.file_modificaciones, 'wb') else: - fio_mod = StringIO() + fio_mod = BytesIO() while True: try: @@ -217,7 +214,7 @@ def calc(self): sys.stderr.flush() if self.interactive: sys.stderr.write("Correcte? ") - raw_input() + input() sys.stderr.flush() start = datetime.now() processes = [multiprocessing.Process(target=self.consumer)