- "# -*- coding: utf-8 -*-\n"
- "import os, shutil, sys, locale\n\n"
- "def unlinkNoThrow(file):\n"
- " ''' remove a file, do not throw if an error occurs '''\n"
- " try:\n"
- " os.unlink(file)\n"
- " except:\n"
- " pass\n\n"
- "def utf8ToDefaultEncoding(file):\n"
- " ''' if possible, convert to the default encoding '''\n"
- " try:\n"
- " language, output_encoding = locale.getdefaultlocale()\n"
- " if output_encoding == None:\n"
- " output_encoding = 'latin1'\n"
- " return unicode(file, 'utf8').encode(output_encoding)\n"
- " except:\n"
- " return file\n\n";
-
- // we do not use ChangeExtension because this is a basename
- // which may nevertheless contain a '.'
- string const to_file = to_file_base + '.'
- + formats.extension(to_format);
+ "# -*- coding: utf-8 -*-\n"
+ "import os, shutil, sys\n\n"
+ "def unlinkNoThrow(file):\n"
+ " ''' remove a file, do not throw if an error occurs '''\n"
+ " try:\n"
+ " os.unlink(file)\n"
+ " except:\n"
+ " pass\n\n";