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

Missleading Errormessage for error 232 #2139

Closed
JPluess opened this issue Oct 26, 2023 · 1 comment
Closed

Missleading Errormessage for error 232 #2139

JPluess opened this issue Oct 26, 2023 · 1 comment

Comments

@JPluess
Copy link

JPluess commented Oct 26, 2023

"I recently made my first attempt with the Python pipe. It worked well as long as I used:

win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_READMODE_MESSAGE | win32pipe.PIPE_WAIT

However, when I switched to:

win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_READMODE_MESSAGE | win32pipe.PIPE_NOWAIT

I encountered misleading errors, specifically Error 232 ('Pipe being closed'). However, the actual reason for this error is that there is nothing to read. My expectation is to update Error 232 to have a more appropriate name. Alternatively, adding a new error, let's say, 'XXX: Nothing to read,' would be helpful.

Here is a snippet of my class:

python

def create_pipe(self):
return win32pipe.CreateNamedPipe(
r'\.\pipe\mypipe',
win32pipe.PIPE_ACCESS_DUPLEX,
win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_READMODE_MESSAGE | win32pipe.PIPE_NOWAIT, #PIPE_WAIT
1, 65536, 65536, 0, None)

def get_message(self) -> Dict:
try:
# Read data from the pipe
(result_status, data) = win32file.ReadFile(self.pipe, self.buffer_read)
# Check if the read was successful
if result_status == 0:
# Decode the received data
received_packet = self.pkg_decode(data.decode('utf-8'))
return received_packet
except Exception as e:
print(e) # Updated error message -> (232, 'ReadFile', 'The pipe is being closed.')
return None

Pywin32, Version 306

There is even a report on stackoverflow:
https://stackoverflow.com/questions/19636548/named-pipe-232-the-pipe-is-being-closed

@mhammond
Copy link
Owner

We can only tell you what windows tells us...

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

2 participants