8000 Refactor codebase for Python 3 compatibility by CodeBreaker44 · Pull Request #11 · devdri/awake · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refactor codebase for Python 3 compatibility #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CodeBreaker44
Copy link
  1. Updated syntax (e.g., print function, etc.).
  2. Replaced obsolete libraries or functions with Python 3 equivalents.
  3. Updated dependencies to versions compatible with Python 3.

@Acters
Copy link
Acters commented Dec 23, 2024

This does not work because you did not update rom.py and address.py properly.

In the rom.py, the Rom class function get(self, addr) makes a function call to struct.unpack that which will expect self.data[addr.physical()] to be the type bytes and will throw an error. I found that it is fine to do this dirty trick to quickly get it to work:

    def get(self, addr):
        return struct.unpack('B', (self.data[addr.physical()]).to_bytes(1,"little") if type(self.data[addr.physical()]) == int else self.data[addr.physical()])[0]

however, then in the address.py file, the following error will occur:

    if ":" not in conventional:
       ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: a bytes-like object is required, not 'str'

I am unsure what causes this, but another dirty trick of adding this into the function would be fine enough for my current ROM:

def fromConventional(conventional):
    if type(conventional) == bytes:
        conventional = conventional.decode()

I know I randomly showed up, but I was looking at a ROM and gave this a shot. I don't have much to provide in help, but this worked for me, so far. I haven't tried all the features but I do notice there is also a problem with the server.py as it writes to the socket and it will error because writing to the socket expects bytes. which means the strings need to be encoded or designated with b""

I notice you made this PR recently, but the author didnt update it in more than a decade. looks like it will not be merged, but thank you for making the PR either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0