X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fscripts%2Ftex_copy.py;h=bb0cc68b72acff179150f2169059546e9b9befa8;hb=4597622ce50a4c00d4a7bf8ee9639fec03c7a8dc;hp=6c634c115e10bac01f3ba1659fc790d1d009eb90;hpb=2ae2c0db71bc88ac0c3e11c3cbd33e6a90ae8f6d;p=lyx.git diff --git a/lib/scripts/tex_copy.py b/lib/scripts/tex_copy.py index 6c634c115e..bb0cc68b72 100644 --- a/lib/scripts/tex_copy.py +++ b/lib/scripts/tex_copy.py @@ -1,5 +1,4 @@ -#! /usr/bin/env python -# -*- coding: iso-8859-1 -*- +# -*- coding: utf-8 -*- # file tex_copy.py # This file is part of LyX, the document processor. @@ -11,7 +10,7 @@ # Full author contact details are available in file CREDITS # Usage: -# tex_copy.py from file> +# tex_copy.py # This script will copy a file to . # is no exact copy of , but any occurence of @@ -53,7 +52,13 @@ def main(argv): latex_file = argv[3] latex_base, latex_ext = os.path.splitext(latex_file) + # convert strings to bytes since we are using binary files + from_base = from_base.encode() + latex_base = latex_base.encode() + # Read the input file and write the output file + if(not os.path.isfile(abs_from_file)): + error("%s is not a valid file.\n" % abs_from_file) from_file = open(abs_from_file, 'rb') to_file = open(abs_to_file, 'wb') lines = from_file.readlines()