Send error messages to stderr instead of stdout. (nw)

This commit is contained in:
Mike Naberezny 2015-03-05 15:04:37 -08:00
parent 2dfeced11b
commit b73285d6b3
4 changed files with 10 additions and 10 deletions

View File

@ -26,7 +26,7 @@ else:
try:
myfile = open(srcfile, 'rb')
except IOError:
print("Unable to open source file '%s'" % srcfile)
sys.stderr.write("Unable to open source file '%s'\n" % srcfile)
sys.exit(-1)
byteCount = os.path.getsize(srcfile)
@ -56,5 +56,5 @@ try:
dst.write('\n};\n')
dst.close()
except IOError:
print("Unable to open output file '%s'" % dstfile)
sys.stderr.write("Unable to open output file '%s'\n" % dstfile)
sys.exit(-1)

View File

@ -10,7 +10,7 @@ def parse_file(srcfile):
try:
fp = open(srcfile, 'rb')
except IOError:
print("Unable to open source file '%s'" % srcfile)
sys.stderr.write("Unable to open source file '%s'\n" % srcfile)
return 1
in_comment = 0
linenum = 0

View File

@ -15,7 +15,7 @@ def name_to_type(name):
return 2
if name == "s26":
return 3
print "Unknown chip type name %s" % name
sys.stderr.write("Unknown chip type name %s\n" % name)
sys.exit(1)
def type_to_device(dtype):
@ -96,7 +96,7 @@ class Hash:
if val in self.d:
h = self.d[val]
if h.premask != premask:
print "Premask conflict"
sys.stderr.write("Premask conflict\n")
sys.exit(1)
return h
h = Hash(premask)
@ -105,7 +105,7 @@ class Hash:
def set(self, val, opc):
if val in self.d:
print "Collision on %s" % opc.description()
sys.stderr.write("Collision on %s\n" % opc.description())
sys.exit(1)
self.d[val] = opc
@ -331,7 +331,7 @@ class OpcodeList:
if v in h.d:
d = h.d[v]
if not d.is_dispatch():
print "Collision on %s" % opc.description()
sys.stderr.write("Collision on %s\n" % opc.description())
sys.exit(1)
if opc.enabled:
d.enabled = True

View File

@ -121,15 +121,15 @@ else:
chdmanBin = os.path.normpath(os.path.join(currentDirectory, "..", "..", "..", "chdman"))
if not os.path.exists(chdmanBin):
print chdmanBin + " does not exist"
sys.stderr.write(chdmanBin + " does not exist\n")
sys.exit(1)
if not os.path.exists(inputPath):
print inputPath + " does not exist"
sys.stderr.write(inputPath + " does not exist\n")
sys.exit(1)
if not os.path.exists(outputPath):
print outputPath + " does not exist"
sys.stderr.write(outputPath + " does not exist\n")
sys.exit(1)
if os.path.exists(tempPath):