diff --git a/atrcopy/__init__.py b/atrcopy/__init__.py index c1aa079..28e416a 100644 --- a/atrcopy/__init__.py +++ b/atrcopy/__init__.py @@ -253,7 +253,7 @@ def assemble(image, source_files, data_files, obj_files, run_addr=""): def boot_image(image_name, source_files, data_files, obj_files, run_addr=""): try: image_cls = parsers_for_filename(image_name)[0] - except InvalidDiskImage, e: + except InvalidDiskImage as e: print("%s: %s" % (image_name, e)) return None segments, run_addr = assemble_segments(source_files, data_files, obj_files, run_addr) @@ -356,7 +356,7 @@ def create_image(template, name): try: data, inf = get_template_data(template) - except InvalidDiskImage, e: + except InvalidDiskImage as e: info = get_template_info() print("Error: %s\n\n%s" % (e, info)) return @@ -548,6 +548,8 @@ def run(): args.append('list') else: disk_image_name = None + parser.print_help() + sys.exit(1) # print "parsing: %s" % str(args) options = parser.parse_args(args) diff --git a/atrcopy/ataridos.py b/atrcopy/ataridos.py index 1a3acad..a1caa69 100644 --- a/atrcopy/ataridos.py +++ b/atrcopy/ataridos.py @@ -350,7 +350,7 @@ class AtrHeader(BaseHeader): if len(bytes) == 16: values = bytes.view(dtype=self.format)[0] if values[0] != 0x296: - raise InvalidAtrHeader + raise InvalidAtrHeader("no ATR header magic value") self.image_size = (int(values[3]) * 256 * 256 + int(values[1])) * 16 self.sector_size = int(values[2]) self.crc = int(values[4]) @@ -358,7 +358,7 @@ class AtrHeader(BaseHeader): self.flags = int(values[6]) self.header_offset = 16 else: - raise InvalidAtrHeader + raise InvalidAtrHeader("incorrect AHC header size of %d" % len(bytes)) def __str__(self): return "%s Disk Image (size=%d (%dx%dB), crc=%d flags=%d unused=%d)" % (self.file_format, self.image_size, self.max_sectors, self.sector_size, self.crc, self.flags, self.unused) @@ -743,7 +743,6 @@ class AtariDiskImage(BootDiskImage): return "%s Unidentified Contents" % (self.header) def check_size(self): - print self.header if self.header is None: raise ("Not a known Atari disk image format")