Beispiel #1
0
 def __init__(self, path, encoding="utf-8"):
     try:
         self.__file = open(script2sys(path), "w")
     except Exception, err:
         raise ExportFixException("errSaveFileName",
                                  file=path,
                                  msg=sys2script(err.message))
Beispiel #2
0
	def __init__(self, exportTracer):
		ExportWriter.__init__(self, exportTracer)
		fileName = self.outInfo.dstFile
		try:
			self.__file = open(script2sys(fileName), "w")
		except Exception, err:
			raise ExportFixException("errSaveFileName", file=fileName, msg=sys2script(err.message))
Beispiel #3
0
	def __init__(self, exportTracer):
		ExportWriter.__init__(self, exportTracer)
		fileName = self.outInfo.dstFile
		path = os.path.split(fileName)[0]
		if not os.path.exists(script2sys(path)):
			raise ExportFixException("errSaveFilePath", path=path)
		try:
			self.__file = open(script2sys(fileName), "w")
		except Exception, err:
			raise ExportFixException("errSaveFileName", file=fileName, msg=sys2script(err.message))
Beispiel #4
0
    def getSheet(self, fileName, encoding):
        """
		获取一个 CSV 表格
		fileName 的编码必须与本程序脚本使用的编码一致
		"""
        fileName = Path.normalizePath(fileName)
        sysFileName = script2sys(fileName)
        if fileName in self.__sheets:
            return self.__sheets[fileName]
        if not os.path.exists(sysFileName):
            raise CSVFixException("errUnexist", file=fileName)
        try:
            file = open(sysFileName, "rb")
        except Exception, err:
            raise DataSourceException(sys2script(err.__str__()))
Beispiel #5
0
def enter():
    """
	argv[1]		导出模板路径
	"""
    args = sys.argv[1:]
    if len(args) < 1 or len(args[0]) == 0:
        Printer.dout("theme", "errorArgs")
        engine.exit(1)
    tplRoot = sys2script(args[0])

    # 初始化环境变量
    _initEnvironment()
    # 打印版本信息
    _printAppMsg()
    # 初始化导出模板
    tplModule = _initExportTpl(tplRoot)

    try:
        exporter.export(tplModule)
    except BaseException, err:
        if not _isDebug(): print err.sysMsg
        else: sys.excepthook(BaseException, err, sys.exc_traceback)
        messageBox(err.scriptMsg, "ERROR", MB_OK, MB_ICONSTOP)
        engine.exit(1)
Beispiel #6
0
 def __getFullPath(rpath):
     path = Path.realToExecutePath(rpath)
     return sys2script(path)