Commits

Anonymous committed 89f769e

Use module "shutil" for file copy and delete.

  • Participants
  • Parent commits d1a558e

Comments (0)

Files changed (1)

 import re
 import string
 import os
+import shutil
 import sys
 import glob
 import textwrap
 TeX_file.write(latex_src)
 TeX_file.close()
 
-os.system("cp %s %s" % (input_filename, temp_dir + os.sep + input_filename))
+shutil.copyfile(input_filename, temp_dir + os.sep + input_filename)
 
 command = "cd %s; pdflatex -interaction=nonstopmode %s.tex" % (temp_dir,output_filename)
 
         for line in pdflatex_output.readlines():
             print line,
 
-os.system("cp %s %s" % (temp_dir + os.sep + output_filename + ".pdf", output_filename + ".pdf"))
+shutil.copyfile(temp_dir + os.sep + output_filename + ".pdf", output_filename + ".pdf")
 
 if options.working_dir == 'automatic':
-    os.system("rm -r %s" % temp_dir)
+    shutil.rmtree(temp_dir)