[BangPypers] Plzzz help me!!!!!!!!!

Smrutilekha Swain smrutilekha at gmail.com
Mon Jan 18 07:07:39 CET 2010


hi...this is my code...but...it is not working...in this programme i want
the pdf will be copied from source to destination after it is generated....

##############################################

import os
import shutil

src = os.getcwd()
dest = "E:\home\smruti\Python\PostMissionAnalysis\presentation"

#################################################################

def file_moved(filename):
    #filename = 'newfile.pdf'
    file_list = os.listdir(os.curdir)
    for eachfile in file_list:
        if (eachfile == filename):
            shutil.copy(src,dest)
            print "The File is moved"

##################################################################

preamble = """\\documentclass{beamer}
\\usepackage{ifpdf}
\\usetheme{Warsaw}
%\\usepackage(times)
\\title{A Sample Of Beamer}
\\author{Smruti}
\\date{\\today}

\\begin{document}

\\begin{frame}[t,plain]
  \\titlepage
\\end{frame}
"""

newfile = open('newfile.tex','w')
newfile.write(preamble)


screenshotlist = glob.glob('*.png')
newfile.write("""\section{screenshot}""")

for figure in screenshotlist:
    includestring = """\\includegraphics[center]{""" + figure + """}"""
    newfile.write("""\\begin{frame}
    \\frametitle{""")
    newfile.write("""}
    \\begin{center}""")
    newfile.write(includestring)
    newfile.write("""
    \\end{center}
    \\end{frame}
    """)

newfile.write("""\section{document}""")
newfile.write("""\end{document}""")

#os.read(newfile,1)
newfile.close()
os.system('pdflatex newfile.tex')
pdf_file = open('newfile.pdf', 'r')
#pdf_file = 'newfile.pdf'
file_moved(pdf_file)
pdf_file.close()

####################################################################


More information about the BangPypers mailing list