output of SELECT in "hex" UTF-8 and matplotlib output error
Hi,
running a SQL select using ibm_db_dbi is showing in b'\xf2\xf0\xf1\xf9\xf0\xf5\xf2\xf8 format.
How can I change that?
Also, running the matplot sample (provided in the https://ibmsystemsmag.com/Power-Systems/11/2019/How-to-Start-ml-on-IBM-i article), give me the below error:
_tkinter.TclError: no display name and no $DISPLAY environment variable
I tried replacing TkAgg by Agg but it did not work.
Thank you,
Roger
NB: I could provide more details if needed.
Comments (9)
-
-
reporter Hi Kevin,
Thanks for the quick reply.
Comments: We have a bunch of files (or tables in SQL lingo) with ccsid 65535 (was default when the files were created - V1R1M2…
Unless you have a better solution, I will have to find a way to test in SQL if CCSID = 65535, CAST it as you are suggesting.
On the subject of the X11Forwarding, I had changed it already, but I am using putty, & dont know how to include the -Y in that case.
Thanks again,
Roger
-
There is no -Y option in Putty, you have to configure it through the GUI as shown in the superuser.com link I gave above. You also need to install and set up an X server, which is also linked in that answer.
-
Personally, I’ve found setting up X11 and forwarding to be a pain on Windows, so you may have better luck going to the Jupyter section. You can do the same thing there with matplotlib, but it shows up in the web browser instead of trying to draw a GUI remotely over the network.
-
reporter I tried it from jupyter & got
TclError: no display name and no $DISPLAY environment variable
What am I missing?
Thanks
-
To run in Jupyter, you need to not tell it to use TK for the backend. ie. remove
mpl.use("TkAgg")
. Jupyter will automatically set up the correct backend for matplotlib to use.here’s an example
import matplotlib.pyplot as plt plt.plot([1,3,2,4]) plt.ylabel('some numbers')
-
reporter removing the use(“TkAgg”) solved my issue,
Thanks
-
reporter Please close this issue.
Happy Thanksgiving…
-
- changed status to resolved
Glad to hear! Happy Thanksgiving to you as well!
- Log in to comment
My guess is the value you are selecting is tagged with CCSID 65535 or is CHAR FOR BIT DATA. You’ll need to cast it to a character string with a convertible CCSID.
As to the
$DISPLAY
issue, that’s usually due to X11 forwarding not being set up properly. I think you need to look at these instructions:To make it work, you have to make your sshd forwarding the GUI information from IBM i to your ssh client. This could be done to modify the sshd_config file under /QOpenSys/QIBM/ProdData/SC1/OpenSSH/etc/. The following line should be changed from
to
After this change restart your ssh server by STRTCPSVR and restart your client with following command. Please note “-Y” is necessary here.
If you’re running from Windows using Putty, this answer might help: https://superuser.com/a/119908. If you’re on macOS, you’ll need to install XQuartz: https://www.xquartz.org/ If you’re on Linux or another Unix-like system, your GUI should already support X11.