return path
while '\\\\' in path :
path = path.replace('\\\\', '\\')
- if sys.platform == 'win32' and path.startswith('\\') and not path.startswith('\\\\') :
+ if path.startswith('\\') and not path.startswith('\\\\') :
path = '\\' + path
return path
def __getitem__(self, key):
return self.tgen[key]
- def read(self, path):
+ def read(self, path = None):
+ if path is None :
+ path = self.path
with codecs.open(path, 'r', self.encoding) as f :
tgen = f.read()
tgen = [line.split('\t') for line in tgen.splitlines()]
return [i, int(line[0]), int(line[1]), float(line[2]), float(line[3]), line[6], line[4], line[5]]
def ReadProfileAsDico(File, Alceste=False, encoding = sys.getdefaultencoding()):
- #print 'lecture des profils : ReadProfileAsDico'
- #if Alceste :
- # print 'lecture du dictionnaire de type'
- # dictlem = {}
- # for line in parent.corpus.lem_type_list :
- # dictlem[line[0]] = line[1]
dictlem = {}
print 'lecture des profiles'
- #encoding = sys.getdefaultencoding()
FileReader = codecs.open(File, 'r', encoding)
Filecontent = FileReader.readlines()
FileReader.close()
return '\n\n'.join(proflist)
def formatExceptionInfo(maxTBlevel=5):
- cla, exc, trbk = sys.exc_info()
- try :
- excName = cla.__name__
- except :
- excName = 'None'
- try:
- excArgs = exc.args[0]
- except :
- excArgs = "<no args>"
- excTb = traceback.format_tb(trbk, maxTBlevel)
- return (excName, excArgs, excTb)
+ cla, exc, trbk = sys.exc_info()
+ try :
+ excName = cla.__name__
+ except :
+ excName = 'None'
+ try:
+ excArgs = exc.args[0]
+ except :
+ excArgs = "<no args>"
+ excTb = traceback.format_tb(trbk, maxTBlevel)
+ return (excName, excArgs, excTb)
#fonction des etudiants de l'iut
else :
parent = self
try :
- print '###horrible hack progressbar'
maxi = int(maxi)
except :
maxi = 1