Skip to content
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

TypeError in helpers.py When Using ctypes.WinDLL #32

Open
gnbon opened this issue Jan 29, 2024 · 1 comment
Open

TypeError in helpers.py When Using ctypes.WinDLL #32

gnbon opened this issue Jan 29, 2024 · 1 comment

Comments

@gnbon
Copy link

gnbon commented Jan 29, 2024

Hello,

I encountered a TypeError when running a script that involves the ctypes library in Python. Below, I have detailed the issue and my proposed solution.

Issue Description:

When executing the script, the following TypeError is raised:

File "C:\fuzzowski\fuzzowski\helpers\helpers.py", line 139, in get_max_udp_size
    lib = ctypes.WinDLL('Ws2_32.dll'.encode('ascii'))
TypeError: a bytes-like object is required, not 'str'

This error occurs at the point where ctypes.WinDLL is called with a string argument encoded in ASCII format.

Proposed Solution:

It appears that the issue stems from the .encode('ascii') method, which converts the string into a bytes-like object. ctypes.WinDLL, however, expects a string argument. Removing .encode('ascii') from the call should resolve the error.

Thank you.

@gnbon
Copy link
Author

gnbon commented Jan 29, 2024

#33 will correct the TypeError and allow the script to run as intended.

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

No branches or pull requests

1 participant