Running 2 py3270 emulators at same time

We are running an emulator (py3270) to do screen scraping and simulating on line data entering for our mainframe on line system. It works fine except when we try to run 2 at the same time. The first one finishes but the second one gets a keyboard lock exception. Is there any way to get around this error?

To get help you will need to provide enough information so that people have a chance to understand your problem.

Can you post code that you are using?

If its very big then suggest you write a short program that shows the issue.

But given that few people will have a IBM mainframe to test against the best you can hope for is suggestions to try in your code.

You also might consider contacting the maintains of the py3270 code for help.

1 Like

Here are snippets of the code in different members and the traceback error. This code runs fine by itself. If you start one and then another, the second one stops with a locked keyboard. I have got other kind of errors, but they all have to do with the keyboard.

I haven’t done a lot in Python and do not understand the use of the keyboard within an executable. Is there a way for each process to use it’s own keyboard.

75 em = Emulator(visible=True,
76 args=[“-model”, “2”, “-xrm”, “wc3270.verifyHostCert: False”, “-xrm”,
77 “ True”])
78 em = CICSMainWindowEA2DC.move_to_main_window(em, sys.argv, cmcd)

42 em.send_enter()
44 em.wait_for_field()
45 time.sleep(1)
46 em.fill_field(14, 27, user_id, len(user_id))
47 em.fill_field(15, 27, user_pass, len(user_pass))
48 em.send_enter()

Traceback (most recent call last):
File “”, line 1666, in
File “”, line 78, in main
File “”, line 46, in move_to_main_window
File “”, line 494, in fill_field
File “”, line 474, in delete_field
File “”, line 308, in exec_command
File “”, line 82, in execute
File “”, line 102, in handle_result
py3270.CommandError: Keyboard locked

My wild guess is that the keyboard in the errors means the emulated keyboard.

This is very specific to the py3270 code. You need to ask its author for help. Maybe log an issue on github GitHub - IBM/py3270: py3270 is a Python interface to x3270, an IBM 3270 terminal emulator. It provides an API to a x3270 or s3270 subprocess.
It seems IBM is the maintainer,

I’m not sure if it’s directly related to x3270. I would defer to more experienced Python users that have dealt with creating processes that use key strokes. Can a process be encapsulated so the keyboard or key strokes only relate to that process? Can you run 2 of the same processes at the same time?

Why do you think this? That does not make sense for a emulator.

I’m saying it doesn’t have to be related to my situation (x3270) for the problem to occur. I’m just trying to get more ideas relating to or not related to x3270 about encapsulating a process that uses keystrokes.

My guess is that the error is that is only to do with the 3270 code.
It is not an error from subprocess, for example, that is implied in your guess.

How did you get on asking the author for help?

I’m not sure about the asking the author part, I just thought it was a forum.

On github you can create a bug ticket here Issues · py3270/py3270 · GitHub

Do that with the traceback and other information you provided here.

Also have you tried reading the code of the library to see what is doing when the exception is raised?

As you have the source code there is no reason you cannot add extra code to print out info to help debug the library yourself.

I’ll try that, thanks