-
Notifications
You must be signed in to change notification settings - Fork 21
TLS connection issue. Works with config file but does not work with parameters. #19
Description
My issue is with TLS connection. Basically when I'am using a configuration file it works fine but when I'am using parameters on the p3270Client method then it doesn't work and the connection just fail. You will find below a trace with the 2 scenarios.
My python application to use directly the x3270 application that you have created and I have some issues with TLS connections. Basically, when I'am using a config file it works fine as what the debug output below shows:
Python instruction: client = p3270.P3270Client(configFile=cfgfile)
cfgfile =
hostname = x.x.x.x
port = 992
model = 3279-2
codePage = cp037
enableTLS = yes
verifyCert = yes
Debug output:
--- Logging error ---
Traceback (most recent call last):
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\logging__init__.py", line 1110, in emit
msg = self.format(record)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\logging__init__.py", line 953, in format
return fmt.format(record)
^^^^^^^^^^^^^^^^^^
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\logging__init__.py", line 687, in format
record.message = record.getMessage()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\logging__init__.py", line 377, in getMessage
msg = msg % self.args
~~~~^~~~~~~~~~~
TypeError: not all arguments converted during string formatting
Call stack:
File "C:\Users\my_user\Documents\git\Check1\RBO-TLS.py", line 175, in <module>
main()
File "C:\Users\my_user\Documents\git\Check1\RBO-TLS.py", line 98, in main
client = p3270.P3270Client(configFile=cfgfile)
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\site-packages\p3270\p3270.py", line 108, in init
self.s3270 = S3270(self.args, self.conf.encoding)
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\site-packages\p3270\p3270.py", line 27, in init
logger.debug('Calling s3270 with the following args: ', self.args)
Message: 'Calling s3270 with the following args: '
Arguments: (['s3270', '-model', '3279-2', '-port', '992', '-charset', 'cp037', '-noverifycert'],)</module>
When it does not work I have this from the command line:
Python instruction: client = p3270.P3270Client(hostName='x.x.x.x', hostPort='992',configFile=None, verifyCert='no', enableTLS='yes', codePage='cp037', path=None, timeoutInSec=20)
Debug error:
--- Logging error ---
Traceback (most recent call last):
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\logging__init__.py", line 1110, in emit
msg = self.format(record)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\logging__init__.py", line 953, in format
return fmt.format(record)
^^^^^^^^^^^^^^^^^^
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\logging__init__.py", line 687, in format
record.message = record.getMessage()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\logging__init__.py", line 377, in getMessage
msg = msg % self.args
~~~~^~~~~~~~~~~
TypeError: not all arguments converted during string formatting
Call stack:
File "C:\Users\my_user\Documents\git\Check1\RBO-TLS.py", line 176, in <module>
main()
File "C:\Users\my_user\Documents\git\Check1\RBO-TLS.py", line 99, in main
client = p3270.P3270Client(hostName='10.137.18.18', hostPort='992', verifyCert='no', enableTLS='yes', path='wc3270\')
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\site-packages\p3270\p3270.py", line 108, in init
self.s3270 = S3270(self.args, self.conf.encoding)
File "C:\Users\my_user\AppData\Local\Programs\Python\Python311\Lib\site-packages\p3270\p3270.py", line 27, in init
logger.debug('Calling s3270 with the following args: ', self.args)
Message: 'Calling s3270 with the following args: '
Arguments: (['wc3270\s3270', '-model', '3279-2', '-port', '992', '-charset', 'cp037'],)
**Connection failed !</module>**
As you can see above there is a difference in the parameter that are passed. The '-noverifycert' is not passed to the module. So, I believe this is why it does not work. I would rather pass the parameter through the class/method call rather using a configuration file as this make things a bit more complex.