eric6/eric6_api.py

changeset 7785
9978016560ec
parent 7781
607a6098cb44
child 7836
2f0d208b8137
equal deleted inserted replaced
7784:3257703e10c5 7785:9978016560ec
294 294
295 outdir = os.path.dirname(outputFile) 295 outdir = os.path.dirname(outputFile)
296 if outdir and not os.path.exists(outdir): 296 if outdir and not os.path.exists(outdir):
297 os.makedirs(outdir) 297 os.makedirs(outdir)
298 try: 298 try:
299 out = open(outputFile, "w", encoding="utf-8", newline=newline) 299 with open(outputFile, "w", encoding="utf-8",
300 out.write("\n".join(sorted(apis)) + "\n") 300 newline=newline) as out:
301 out.close() 301 out.write("\n".join(sorted(apis)) + "\n")
302 except IOError as v: 302 except IOError as v:
303 sys.stderr.write("{0} error: {1}\n".format(outputFile, v[1])) 303 sys.stderr.write("{0} error: {1}\n".format(outputFile, v[1]))
304 sys.exit(3) 304 sys.exit(3)
305 try: 305 try:
306 out = open(basesFile, "w", encoding="utf-8", newline=newline) 306 with open(basesFile, "w", encoding="utf-8",
307 for baseEntry in sorted(basesDict.keys()): 307 newline=newline) as out:
308 out.write("{0} {1}\n".format( 308 for baseEntry in sorted(basesDict.keys()):
309 baseEntry, " ".join(sorted(basesDict[baseEntry])))) 309 out.write("{0} {1}\n".format(
310 out.close() 310 baseEntry, " ".join(sorted(basesDict[baseEntry]))))
311 except IOError as v: 311 except IOError as v:
312 sys.stderr.write("{0} error: {1}\n".format(basesFile, v[1])) 312 sys.stderr.write("{0} error: {1}\n".format(basesFile, v[1]))
313 sys.exit(3) 313 sys.exit(3)
314 314
315 sys.stdout.write('\nDone.\n') 315 sys.stdout.write('\nDone.\n')

eric ide

mercurial