def getIndigoExceptionText(e): if isJython(): return e.message elif isIronPython(): return e.Message.replace("\\'", "'") else: value = str(e) if value[0] == '\'' and value[-1] == '\'': value = value[1:-1] if value[0] == '"' and value[-1] == '"': value = value[1:-1] return value.replace("\\'", "'")
def open_file_utf8(filename): import codecs if isJython(): return open(filename, 'wt') elif isIronPython(): # TODO: FIXME (maybe on C# site?) return codecs.open(filename, 'wb', encoding='utf-8') # FAILED: wrong symbols # return open(filename, 'wt') # ERROR: UnicodeEncodeError: 'ascii' codec can't encode character '\uFFFD' in position 814: ordinal not in range(128) # return open(filename, 'wb') # ERROR: UnicodeEncodeError: 'ascii' codec can't encode character '\uFFFD' in position 724: ordinal not in range(128) # return codecs.open(filename, 'wb') # # ERROR: UnicodeEncodeError: 'ascii' codec can't encode character '\uFFFD' in position 724: ordinal not in range(128) else: if sys.version_info.major < 3: return open(filename, 'wt') else: return codecs.open(filename, 'wb', encoding='utf-8')
def __init__(self, path=None): Indigo.__init__(self, path) if isJython() or isIronPython(): IndigoObject = IndigoObjectCoverageWrapper # TODO: Change standard IndigoObject to IndigoObjectCoverageWrapper else: self.IndigoObject = IndigoObjectCoverageWrapper self._indigoObjectCoverageDict = dict() self._indigoObjectCoverageByTypeDict = dict() m = self.createMolecule() for item in getmembers(m): if type(item[1]) in (BuiltinFunctionType, BuiltinMethodType, MethodType, FunctionType) and not item[0].startswith('_'): self._indigoObjectCoverageDict[item[0]] = 0 self._indigoCoverageDict = dict() for item in getmembers(self): if type(item[1]) in (BuiltinFunctionType, BuiltinMethodType, MethodType, FunctionType) and not item[0].startswith('_'): self._indigoCoverageDict[item[0]] = 0
cur_path, "%s/Indigo.Net.dll" % (dll_full_path_base))) if not os.path.exists(dll_full_path): continue break os.environ['INDIGO_PATH'] = dll_full_path import clr for item in os.environ['INDIGO_PATH'].split(os.pathsep): cdll_indigo(item) clr.AddReferenceToFileAndPath(item) from com.epam.indigo import * success = True elif isJython(): if not 'INDIGO_PATH' in os.environ: dll_full_path = os.path.normpath( os.path.abspath( os.path.join( indigo_root, "api/java/target/indigo-%s.jar" % getIndigoVersion()))) rdll_full_path = os.path.normpath( os.path.abspath( os.path.join( indigo_root, "api/plugins/renderer/java/target/indigo-renderer-%s.jar" % getIndigoVersion()))) idll_full_path = os.path.normpath( os.path.abspath( os.path.join(