Comments (7)
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
Great. Thanks for testing.
from python-itoolkit.
Original comment by Siegfried (Bitbucket: zipperlemeran, GitHub: Unknown).
Hello Tony,
yes I installed the new itoolkit 1.3 and it works.
Thousand thanks for you effort.
Mille grazie
Siegfried
from python-itoolkit.
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
python3-itoolkit - change iLibCall - fix UnicodeDecodeError
YIPs python3-itoolkit-1.3.zip - change iLibCall - fix UnicodeDecodeError: ascii codec cannot decode byte 0xc3
Please download fix 1.3 and install with pip3 (above). Let us know if it works for you.
from python-itoolkit.
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
python3-itoolkit - change iLibCall - fix UnicodeDecodeError
Ok, I have a new wheel on Yips for download.
Works latin-1 or utf-8 test
latin-1
#!bash
bash-4.3$ python3 italy-latin-1.py
<?xml version="1.0" ?><xmlservice><fake>non � domani</fake></xmlservice>
#!python
# -*- coding: latin-1 -*-
from itoolkit import iToolKit
from itoolkit import iXml
from itoolkit.lib.ilibcall import iLibCall
itransport = iLibCall("*here *cdata") # *debug i will stop, inquiry message qsysopr
itool = iToolKit()
#itool.add(iXml("it's not tomorrow"))
itool.add(iXml('<fake>non è domani</fake>')) # latin-1
itool.call(itransport)
print(itool.xml_out())
utf-8
#!bash
bash-4.3$ python3 italy-utf-8.py
<?xml version="1.0" ?><xmlservice><fake>non � domani</fake></xmlservice>
#!python
# -*- coding: utf-8 -*-
from itoolkit import iToolKit
from itoolkit import iXml
from itoolkit.lib.ilibcall import iLibCall
itransport = iLibCall("*here *cdata") # *debug i will stop, inquiry message qsysopr
itool = iToolKit()
# itool.add(iXml('<fake>non è domani</fake>')) # latin-1
itool.add(iXml('<fake>non \u00E8 domani</fake>')) # utf-8
itool.call(itransport)
print(itool.xml_out())
from python-itoolkit.
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3
Mm, python-itoolkit iLibCall may be able make a change to help. That is, experimenting with python 2 (works) vs. python 3 (not work), we think changing c-code for iLibCall may help.
#!bash
bash-4.3$ python italy.py ... ok
<?xml version="1.0" ?><xmlservice><fake>non \u00E8 domani</fake></xmlservice>
bash-4.3$ python3 italy.py ... bad
Traceback (most recent call last):
File "italy.py", line 16, in <module>
File "/QOpenSys/QIBM/ProdData/OPS/Python3.4/lib/python3.4/site-packages/itoolkit/itoolkit.py", line 1098, in call
xml_out = itrans.call(self)
File "/QOpenSys/QIBM/ProdData/OPS/Python3.4/lib/python3.4/site-packages/itoolkit/lib/ilibcall.py", line 88, in call
return itoolkit.itoollib.xmlservice(itool.xml_in(),self.ctl,self.ipc,self.ebcdic_ccsid,self.pase_ccsid)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 44: ordinal not in range(128)
bash-4.3$ cat italy.py
# -*- coding: utf-8 -*-
:
itool.add(iXml('<fake>non \u00E8 domani</fake>')) # utf-8
:
So, I will attempt modify c code (itoollib.so), and build a new wheel (egg). I can post the 'test wheel fix' on Yips (soon).
Will you be willing to test in your environment?
iDb2Call (ibm_db python)
I did not check null user/password.
from python-itoolkit.
Original comment by Siegfried (Bitbucket: zipperlemeran, GitHub: Unknown).
Hello Tony,
thank you for the answer.
The only solution that works is using idb2call(). Any other try throws the same error mentioned above.
But with idb2Call() there must be passed a user id and a password. Passing a generic user id like QPGMR I get the wrong job attributes for user X. Is there any possibility to use the current user id for iTransport?
Thank you
Siegfried
from python-itoolkit.
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
UnicodeDecodeError: 'ascii' codec ... /lib/ilibcall.py", line 88, in call return
You may have to try these things one at a time. We are faced with a daunting ebcdic task as IBM i has not allowed a unicode job description (cough, just sayin' ... whining he did)
Note: Depending on shell following env settings have different built-ins for 'export'. Assuming modern shell like bash 'export' works. I cannot recall qp2term (evil death of all joy green screen abomination qp2term ... not that i have opinion).
#!bash
> export LANG=it_IT
> export CCSID=1208
- env.txt - You have confusing LANG settings, possibly inherited shell settings. We see both generic ascii LANG=C (active) and Italian PASE_LANG=it_IT (not active).
#!bash
export LANG=it_IT
- env.txt - switch to UTF-8 pase ccsid (CCSID=1208). Your env has QIBM_PASE_CCSID=819 and CCSID=819. Python 3 loves UTF-8 (1208) ... and ... nothing else ... nothing else ... nothing else. Cough, you could try python 2 with more liberal view of NLS (did i say that out loud?).
#!bash
export CCSID=1208
Try new things ...
- Switch to iDB2Call transport. DB2 implicit convert ascii/ebcdic (no human fumbling). This may be you best option.
#!python
from itoolkit.db2.idb2call import *
itransport = iDB2Call(user,password)
Try old things a new way ...
- Try override ccsid in iLibCall (your current memory transport)
#!python
iLibCall(ictl="*here", ipc="*na", iccsid="?ebcdic italian?", pccsid=1208)
from python-itoolkit.
Related Issues (20)
- Drop Python 3.4 Support HOT 4
- _direct.py needs more test coverage
- Add type declarations HOT 17
- Transports need a way to indicate failure HOT 1
- Deprecate the trace functions for standard logging
- Run cl command to create a library in an IASP via DirectTransport on a French system failed HOT 1
- On Japanese or French systems run command via DatabaseTransport fails with ibm_db_dbi::Error HOT 3
- Provide a close() API to close database connections
- PyPI page is outdated HOT 5
- Is there a problem with the Japanese environment in iCmd5250 xml output? HOT 3
- What itoolkit version allows qtemp schema table access using iSqlQuery? HOT 6
- Improve README links on PyPI HOT 3
- RTVJOBA example works only with CCSID=37 HOT 3
- Errors using JayDeBeApi HOT 8
- DatabaseTransport should not close a connection HOT 14
- Stderr handling in SSH Transport can yield wrong results
- Running itool.call ends the program and does nothing HOT 7
- XML Special Character errors/handling HOT 1
- Fix license headers on source files HOT 2
- Error calling Receive DataQ API - QRCVDTAQ HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-itoolkit.