You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you and mstiri for creating p3270 and p5250.
I am trying to automate the execution of various processes using the p5250 module. My goal is to have it run unsupervised, but in testing it seems to get hung up when the network disconnects. I am an amateur at best, so I apologize if any of the following is incorrect and would appreciate your feedback.
Steps to recreate error (during testing I did this in the command line b/c it was the easiest way to disconnect wifi in between commands):
1.) connect to server
from p5250 import P5250Client
my_client = P5250Client(hostName = <hostname string>, path = "/usr/bin/")
if my_client.connect():
print("Connection successful)"
2.) disconnect wifi
3.) send command my_client.sendEnter()
At this point it seems to wait indefinitely until I use a keyboardInterrupt.
4.) After using the keyboardInterrupt, I tried sending the Enter command again. This is when it gives the broken pipe error, which I have been trying to handle with something like below (https://www.geeksforgeeks.org/broken-pipe-error-in-python/).
import sys
import errno
try:
for i in range(4000):
print(i)
except IOError as e:
if e.errno == errno.EPIPE:
pass
# Handling of the error
After looking further into the code, my thought is that the problem is the use of stdin.write() in the do() function of the S3270 class. The subprocess documentation states the following:
Warning Use communicate() rather than .stdin.write, .stdout.read or .stderr.read to avoid deadlocks due to any of the other OS pipe buffers filling up and blocking the child process.
Is this the cause of the hangup? Would using communicate() fix the issue?
I would appreciate any insight you can offer.
The text was updated successfully, but these errors were encountered:
First of all, thank you and mstiri for creating p3270 and p5250.
I am trying to automate the execution of various processes using the p5250 module. My goal is to have it run unsupervised, but in testing it seems to get hung up when the network disconnects. I am an amateur at best, so I apologize if any of the following is incorrect and would appreciate your feedback.
Steps to recreate error (during testing I did this in the command line b/c it was the easiest way to disconnect wifi in between commands):
1.) connect to server
2.) disconnect wifi
3.) send command
my_client.sendEnter()
At this point it seems to wait indefinitely until I use a keyboardInterrupt.
4.) After using the keyboardInterrupt, I tried sending the Enter command again. This is when it gives the broken pipe error, which I have been trying to handle with something like below (https://www.geeksforgeeks.org/broken-pipe-error-in-python/).
After looking further into the code, my thought is that the problem is the use of stdin.write() in the do() function of the S3270 class. The subprocess documentation states the following:
Is this the cause of the hangup? Would using communicate() fix the issue?
I would appreciate any insight you can offer.
The text was updated successfully, but these errors were encountered: