-
Notifications
You must be signed in to change notification settings - Fork 80
ERROR: 'utf-8' codec can't decode byte 0x85 in position 0: invalid start byte #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I am able to confirm that the issue is due to the presence of an xmltype attribute within a database object and will see what is needed to address this issue. |
Good news! I was able to correct the issue. If you are able to build from source you can verify that it works for you, too. |
Great. I have not been building or installing from source. I am using Anaconda/Spyder IDE for this development and not sure how to build from source using that. But let me check. |
I was able to build from source and tried to replace the oracledb folder content with the new local oracledb folder content but must be missing something. Sorry, I'm new to python and may not fully understand the module loading part here. It fails with error - |
I don't know what games Anaconda plays with modules. In a regular installation, however, there should not be a |
I did just copy the oracledb folder in its entirety to the location where anaconda keeps the sitepackages. But it is failing to load. |
It might be easier for you to do this, then, in the source directory:
This will create a wheel in the If the
Let me know if that works better for you. We can update the build from source instructions to give that option. |
Good news! Was able to install the package directly to conda from git. |
When will this fix be available as a release? |
We will discuss internally whether it makes sense to create a patch release in the next week or two; otherwise, it would likely be in a couple of months. Do you need this sooner rather than later? :-) |
A patch release will be great if possible as it would ease our deployment process to aws probably. |
Update: Is there any possibility you could provide a linux zip dist here for us to test it on linux. |
That error implies that you don't have the Python development package installed. You should be able to install that package fairly easily.
We will plan for a patch release. Exact timing is yet to be determined but it should be sometime in the next week or two.
My suggestion is to use the
For Linux a manylinux wheel is going to be the most likely option to succeed. A straight zip file may or may not work depending on the different versions of Linux that we may be running! Since you have been able to compile already and verify that it works for you, creating a wheel shouldn't be too much trouble using the |
I have a windows laptop and hence have tested everything on windows. The lambda environment is rhel Linux and unfortunately I do not have access to it. |
Until we release an update on PyPi, options to get Linux include using VirtualBox, or a free 'Oracle Compute Instance' on https://www.oracle.com/cloud/free/ |
We are struggling a bit getting this build from source working in the AWS Lambda environment where we have to eventually run this. At the moment it fails to import oracledb with the following error - Any familiarity with this? |
Generally you have to create a manylinux wheel or you have to make sure you build your wheel on an older platform than the one you are trying to distribute to! Building a manylinux wheel is fairly straightforward. I don't know what AWS uses, but assuming it uses the x86_64 platform, this is what I use for building wheels: #! /usr/bin/bash
# Produces "manylinux" wheels using a container image built on CentOS 7. For
# additional information, see https://github.com/pypa/auditwheel.
#
# Currently using manylinux2014 (based on CentOS 7):
# podman pull quay.io/pypa/manylinux2014_x86_64
#
# This script should be run in the root directory of a clone of python-oracledb
# with a source distribution package already created and stored within the
# "dist" subdirectory. Once all of the wheels have been built they will be
# placed within the "dist" subdirectory as well.
# ensure that the dist subdirectory exists
if [ ! -d "dist" ]; then
mkdir dist
fi
# generate script for building
SCRIPT_NAME=dist/linux_build_on_container.sh
cat > $SCRIPT_NAME << EOF
#! /bin/bash
cd /io
# build module for all supported Python versions
/opt/python/cp37-cp37m/bin/python3.7 -m build
/opt/python/cp38-cp38/bin/python3.8 -m build
/opt/python/cp39-cp39/bin/python3.9 -m build
/opt/python/cp310-cp310/bin/python3.10 -m build
/opt/python/cp311-cp311/bin/python3.11 -m build
/opt/python/cp312-cp312/bin/python3.12 -m build
# turn the base wheels into "manylinux" wheels
cd dist
auditwheel repair *.whl
rm -f oracledb-*x86_64.whl
mv -i wheelhouse/* .
rm -rf wheelhouse
exit
EOF
chmod +x $SCRIPT_NAME
# run script
sudo podman run -i -t -v `pwd`:/io quay.io/pypa/manylinux2014_x86_64 \
/bin/bash -c /io/$SCRIPT_NAME
rm $SCRIPT_NAME A few notes to help you if you want to use this approach:
Hope that helps! We have discussed creating a patch release and have tenatively scheduled that for early next week. Once it is out I will post here again. |
This was included in version 2.2.1 which was just released. |
Discussed in #335
Originally posted by bnvader May 16, 2024
I am trying to use python oracledb to connect to Oracle Database that has encoding - ISO-8859-1.
I have a custom database type of type DB Table.
When I use thick client mode, I am able to directly use the DBObject.Attribute_Name to retrieve the attribute values from a row.
However this same step fails if I do not use thick mode.
I would like to have this working in thin mode as I want to eventually use this from a simple AWS Lambda function.
Has anyone been able to use thin mode to successfully decode non utf-8 encoded Oracle DB?
If so what is the secret?
The text was updated successfully, but these errors were encountered: