Provide python3 objects to remote control an active pw3270 window or to direct access a TN3270 host using lib3270.
Getting module version
#!/usr/bin/python
#-*- coding: utf-8
import tn3270
print("Using py3270 Version " + tn3270.version() + " revision " + tn3270.revision())
Getting pw3270 version
#!/usr/bin/python
#-*- coding: utf-8
import tn3270
session = tn3270.Session(":a")
print("Using PW3270 version " + session.version + " revision " + session.revision)
Connecting first pw3270 window to host (if not connected), getting contents
#!/usr/bin/python
#-*- coding: utf-8
import tn3270
session = tn3270.Session(":a")
if session.reconnect.try_activate():
print("Reconnecting to host")
session.wait(10)
print(session)
Connecting to host by url, getting some information.
#!/usr/bin/python
#-*- coding: utf-8
import tn3270
# Get TN3270 headless object
session = tn3270.Session("")
# Connect to host with 10 seconds timeout
session.connect("tn3270://localhost:3270",10)
# Show connection state.
print("Cstate: " + str(session.cstate))
print("Width: " + str(session.width))
print("Connected: " + str(session.connected))
# Show cursor position
print(session.cursor)
# Search for string on terminal
print(session.find("Host"))
# Count string
print(session.count("Host"))
# Get 38 characters at position 14,22
print(session.get(14,22,38))
session.disconnect()
input("Press enter to exit")
-
Install libipc3270-devel
-
Get python-tn3270 sources from git
git clone https://github.com/PerryWerneck/python-tn3270.git ./python-tn3270
-
Build the extension using setup.py
cd python-tn3270 python setup.py build
-
Install extension
python setup.py install
-
Download and install Visual Studio Build Tools (https://visualstudio.microsoft.com/pt-br/downloads/)
-
Get python-tn3270 sources from git
git clone https://github.com/PerryWerneck/python-tn3270.git ./python-tn3270
-
Download and unpack libipc3270 pre-compiled image
wget https://github.com/PerryWerneck/libipc3270/releases/download/5.5/msvc-libipc3270.zip 7z x msvc-libipc3270.zip -y -oipc3270
-
Build the extension using setup.py
cd python-tn3270 python setup.py build
-
Install extension
python setup.py install
-
Build windows installer (optional)
python setup.py bdist_wininst