1
我習慣於在python 2.7中工作,所以出現了一些新的東西,例如print函數不同。所以請原諒我的無知。我對編程也很新穎。Python 3.4.1腳本語法錯誤,arcpy&
因此,這裏是我的腳本,我不斷收到這突出一些逗號或空格錯誤,說有一個
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 16-17: malformed \N character escape
代碼:
import arcpy
print("mosaic to new raster starting!")
env.workspace = "F:\GDAL"
arcpy.env.pyramid = "NONE"
arcpy.env.rasterStatistics = "NONE"
arcpy.env.compression = "JPEG 87"
arcpy.env.tileSize = "256 256"
print("Environment set")
RasterInput = "m_3511401_ne_11_1_20130731.jpg;m_3511401_nw_11_1_20130731.jpg;m_3511401_se_11_1_20130731.jpg;m_3511401_sw_11_1_20130731.jpg;"
print("Input set")
arcpy.MosaicToNewRaster_management(RasterInput,"F:\Pro_Projects\NAIP2013\raster.sde","MosaicFile1","","8_BIT_UNSIGNED","","3","LAST","FIRST")
print("mosaic done!")
我覺得問題是你不逃避文件路徑中的字符,特別是反斜槓。請參閱http://stackoverflow.com/questions/3380484/using-backslash-in-python-not-to-escape。 – sovemp 2015-02-24 21:04:31