elliotnunn / tbxi

Mac OS ROM mangler
MIT License
23 stars 2 forks source link

binascii has no attribute a2b_hqx #1

Open halian opened 1 week ago

halian commented 1 week ago

When attempting to dump a binhexed ROM, I get the following error:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\<REDACTED>\AppData\Roaming\Python\Python312\Scripts\tbxi.exe\__main__.py", line 7, in <module>
  File "C:\Users\<REDACTED>\AppData\Roaming\Python\Python312\site-packages\tbxi\__main__.py", line 63, in main
    hb = binhex.HexBin(f)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\<REDACTED>\AppData\Roaming\Python\Python312\site-packages\tbxi\binhex.py", line 371, in __init__
    self._readheader()
  File "C:\Users\<REDACTED>\AppData\Roaming\Python\Python312\site-packages\tbxi\binhex.py", line 389, in _readheader
    len = self._read(1)
          ^^^^^^^^^^^^^
  File "C:\Users\<REDACTED>\AppData\Roaming\Python\Python312\site-packages\tbxi\binhex.py", line 374, in _read
    data = self.ifp.read(len)
           ^^^^^^^^^^^^^^^^^^
  File "C:\Users\<REDACTED>\AppData\Roaming\Python\Python312\site-packages\tbxi\binhex.py", line 307, in read
    self._fill(wtd - len(self.post_buffer))
  File "C:\Users\<REDACTED>\AppData\Roaming\Python\Python312\site-packages\tbxi\binhex.py", line 313, in _fill
    self.pre_buffer = self.pre_buffer + self.ifp.read(wtd + 4)
                                        ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<REDACTED>\AppData\Roaming\Python\Python312\site-packages\tbxi\binhex.py", line 279, in read
    decdatacur, self.eof = binascii.a2b_hqx(data)
                           ^^^^^^^^^^^^^^^^
AttributeError: module 'binascii' has no attribute 'a2b_hqx'. Did you mean: 'a2b_hex'?
elliotnunn commented 1 day ago

Hi! This is frustrating. Python deprecated and removed the binhex package, so I just copied it into the repo, but now supporting functions in the binascii package have been removed too. Worse, they were implemented in C. I think I should probably just remove BinHex support -- what do you think?

halian commented 1 day ago

I'd prefer having BinHex support, as I don't currently have any working computers that can run classic Mac OS.