--- ./wrappers/Python/CoolProp/Plots/psy.py.orig 2022-05-06 08:58:46.000000000 +0200 +++ ./wrappers/Python/CoolProp/Plots/psy.py 2022-05-13 21:41:27.000000000 +0200 @@ -2,18 +2,23 @@ # -*- coding: utf-8 -*- import os -import cPickle -from ConfigParser import ConfigParser +import pickle +from configparser import ConfigParser import numpy as np -from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg from pylab import Figure from CoolProp.HumidAirProp import HAProps, HAProps_Aux -from PyQt4.QtGui import (QDialog, QGridLayout, QProgressBar, QLabel, - QDialogButtonBox, QPushButton, QFileDialog, QApplication) +try: + from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg + from PyQt4.QtGui import (QDialog, QGridLayout, QProgressBar, QLabel, + QDialogButtonBox, QPushButton, QFileDialog, QApplication) +except ImportError: + from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg + from PyQt5.QtWidgets import (QDialog, QGridLayout, QProgressBar, QLabel, + QDialogButtonBox, QPushButton, QFileDialog, QApplication) Preferences = ConfigParser() config_path = os.path.join(os.path.dirname(__file__), "psyrc") @@ -402,7 +407,7 @@ filename = "%i.pkl" % P if os.path.isfile(filename): with open(filename, "r") as archivo: - data = cPickle.load(archivo) + data = pickle.load(archivo) self.status.setText("Loading cached data...") QApplication.processEvents() else: @@ -410,7 +415,7 @@ self.status.setText("Calculating data, be patient...") QApplication.processEvents() data = PsyCoolprop.calculatePlot(self) - cPickle.dump(data, open(filename, "w")) + pickle.dump(data, open(filename, "w")) self.progressBar.setVisible(False) self.status.setText("Plotting...") QApplication.processEvents()