So I have been trying to write some code that takes a MXD from a file converts it to a PDF and dumps it in another file- this is a smaller piece of a larger program that I'm planning on making and everything in it works fine until it reaches the "map.ExportToPDF" portion. At that point the program sits for a few minutes and then IDLE just exits the program. There is no error message and no PDF is created it just simply doesn't execute anything past that point. I've read through any documentation and no else seems to be this specific problem so I assume something is wrong in my code but I can't for the life of me figure out what it is. Code is below im using Python 2.7.14 Shell on Windows. # denote notes.
# imported sys to get the raw inputs and os to use for path separator
import arcpy, sys, os
# Set OverWrite if files already exist
arcpy.env.OverWriteOutput = True
print "Enter folder path: "
mapDoc = raw_input()
#mapDoc = sys.argv[0]
print os.path.dirname(mapDoc)
# set a variable to the full path and file name of the MXD
fullnam = os.path.basename(mapDoc)
# Strip off the MXD file extension and store as string variable for use in the 'out_pdf'
nam = fullnam.strip(".mxd")
print nam
# Commented this out, since it doesnt need to be a parameter when you use the MXD name as the PDF name
##print "Enter save as name:"
#mapName = sys.argv[2]
print('set path successful')
map = arcpy.mapping
mxd = map.MapDocument(mapDoc)
map_document = mxd
out_pdf = r"C:\Users\1388067639E\Documents\mxd_pdfs" + "\\" + nam + ".pdf"
out_pdf = r"C:\Users\1388067639E\Documents\mxd_pdfs" + os.sep + nam + ".pdf"
#out_pdf = os.path.dirname(mapDoc) + os.sep + nam + ".pdf"
#out_pdf = os.path.dirname(mapDoc) + os.sep + nam + ".pdf"
print('output path successful')
# Set all the parameters as variables here:
data_frame = 'PAGE_LAYOUT'
resolution = "300"
image_quality = "NORMAL"
colorspace = "RGB"
compress_vectors = "True"
image_compression = "JPEG"
picture_symbol = 'RASTERIZE_BITMAP'
convert_markers = "False"
embed_fonts = "True"
layers_attributes = "NONE"
georef_info = "False"
jpeg_compression_quality = "80"
print('parameters set successful')
# Due to a known issue, the df_export_width and df_export_height must be set to integers in the code:
map.ExportToPDF(map_document, out_pdf, data_frame, 640, 480, resolution, image_quality, colorspace,
compress_vectors, image_compression, picture_symbol, convert_markers, embed_fonts, layers_attributes,
georef_info, jpeg_compression_quality)
print('map export successful')
# This gives feedback in the script tool dialog:
arcpy.GetMessages()
print('done')