qwertyquerty / pypresence

A complete Discord IPC and Rich Presence wrapper library in Python!
https://qwertyquerty.github.io/pypresence/html/index.html
MIT License
645 stars 77 forks source link

Add fix if len(preamble) < 8 #229

Open pandaninjas opened 11 months ago

pandaninjas commented 11 months ago

This causes a mysterious struct.error when the handshake fails

NikOverflow commented 5 months ago

This causes a mysterious struct.error when the handshake fails

i can't test that. Is it possible that you send a proof of concept how we can trigger that or an stacktrace that shows the error.

pandaninjas commented 5 months ago

Please don't split the handshake function in two functions to keep the pull request as small as possible. Also this error occoured:

Traceback (most recent call last):
  File "/run/media/niklas/Games/pypresence-better/pypresence/test.py", line 14, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/run/media/niklas/Games/pypresence-better/pypresence/test.py", line 8, in main
    await client.start()
  File "/run/media/niklas/Games/pypresence-better/pypresence/pypresence/client.py", line 378, in start
    await self.handshake()
  File "/run/media/niklas/Games/pypresence-better/pypresence/pypresence/baseclient.py", line 123, in handshake
    await create_reader_writer(ipc_path)
          ^^^^^^^^^^^^^^^^^^^^
NameError: name 'create_reader_writer' is not defined

I've fixed the create_reader_writer issue, but the splitting of the functions was to make CI pass. I can undo that if you would like

NikOverflow commented 5 months ago

Please don't split the handshake function in two functions to keep the pull request as small as possible. Also this error occoured:

Traceback (most recent call last):
  File "/run/media/niklas/Games/pypresence-better/pypresence/test.py", line 14, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/run/media/niklas/Games/pypresence-better/pypresence/test.py", line 8, in main
    await client.start()
  File "/run/media/niklas/Games/pypresence-better/pypresence/pypresence/client.py", line 378, in start
    await self.handshake()
  File "/run/media/niklas/Games/pypresence-better/pypresence/pypresence/baseclient.py", line 123, in handshake
    await create_reader_writer(ipc_path)
          ^^^^^^^^^^^^^^^^^^^^
NameError: name 'create_reader_writer' is not defined

I've fixed the create_reader_writer issue, but the splitting of the functions was to make CI pass. I can undo that if you would like

ok this is fine now. Is a proof of concept possible to trigger the problem?

NikOverflow commented 5 months ago

Please don't split the handshake function in two functions to keep the pull request as small as possible. Also this error occoured:

Traceback (most recent call last):
  File "/run/media/niklas/Games/pypresence-better/pypresence/test.py", line 14, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/run/media/niklas/Games/pypresence-better/pypresence/test.py", line 8, in main
    await client.start()
  File "/run/media/niklas/Games/pypresence-better/pypresence/pypresence/client.py", line 378, in start
    await self.handshake()
  File "/run/media/niklas/Games/pypresence-better/pypresence/pypresence/baseclient.py", line 123, in handshake
    await create_reader_writer(ipc_path)
          ^^^^^^^^^^^^^^^^^^^^
NameError: name 'create_reader_writer' is not defined

I've fixed the create_reader_writer issue, but the splitting of the functions was to make CI pass. I can undo that if you would like

Hello, i asked you if you can provide a proof of concept that triggers the error.