py_ext/PythonFileCTNMixin.py
branchpython3
changeset 3752 9f6f46dbe3ae
parent 3750 f62625418bff
child 3806 b57a38ce3f34
equal deleted inserted replaced
3751:a80a66ba52d6 3752:9f6f46dbe3ae
    22 # You should have received a copy of the GNU General Public License
    22 # You should have received a copy of the GNU General Public License
    23 # along with this program; if not, write to the Free Software
    23 # along with this program; if not, write to the Free Software
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    25 
    25 
    26 
    26 
    27 
       
    28 import os
    27 import os
    29 import re
    28 import re
    30 from builtins import str as text
       
    31 
    29 
    32 import util.paths as paths
    30 import util.paths as paths
    33 from xmlclass import GenerateParserFromXSD
    31 from xmlclass import GenerateParserFromXSD
    34 
    32 
    35 from CodeFileTreeNode import CodeFile
    33 from CodeFileTreeNode import CodeFile
    75                     self.CodeFile.globals.setanyText(python_code.getanyText())
    73                     self.CodeFile.globals.setanyText(python_code.getanyText())
    76                     os.remove(filepath)
    74                     os.remove(filepath)
    77                     self.CreateCodeFileBuffer(False)
    75                     self.CreateCodeFileBuffer(False)
    78                     self.OnCTNSave()
    76                     self.OnCTNSave()
    79             except Exception as exc:
    77             except Exception as exc:
    80                 error = text(exc)
    78                 error = str(exc)
    81 
    79 
    82             if error is not None:
    80             if error is not None:
    83                 self.GetCTRoot().logger.write_error(
    81                 self.GetCTRoot().logger.write_error(
    84                     _("Couldn't import old %s file.") % self.CTNName())
    82                     _("Couldn't import old %s file.") % self.CTNName())
    85 
    83