cancel
Showing results for 
Search instead for 
Did you mean: 

Python samples in ASE did not work and fail with an ImportError

robert_kratschmann
Participant
0 Kudos
191

Hi

I want to execute the Python samples with Python 3.11.0 or 3.11.8.
Into %SYBASE%\%SYBASE_OCS%\sample\python I copied the SYBASE.bat file from %SYBASE% and add
variables for DSQUERY, PYTHONHOME, PATH, and PYTHONPATH:
REM
REM SAP Product Environment variables
REM
set INCLUDE=C:\SAP\OCS-16_0\include;%INCLUDE%
set LIB=C:\SAP\OCS-16_0\lib;%LIB%
REM
REM Replace dll, lib3p, and lib3p64 with devdll, devlib3p, and devlib3p64 when debugging
REM
set PATH=C:\SAP\OCS-16_0\bin;C:\SAP\OCS-16_0\dll;C:\SAP\OCS-16_0\lib3p64;C:\SAP\OCS-16_0\lib3p;%PATH%
set PATH=C:\SAP\DataAccess\ODBC\dll;%PATH%
set PATH=C:\SAP\DataAccess64\ODBC\dll;%PATH%
set LIB=C:\SAP\DataAccess\ADONET\dll;%LIB%
set PATH=C:\SAP\DataAccess\ADONET\dll;%PATH%
set PATH=C:\SAP\DataAccess64\ADONET\dll;%PATH%
set LIB=C:\SAP\DataAccess64\ADONET\dll;%LIB%
set PATH=C:\SAP\COCKPIT-4\bin;%PATH%
set PATH=C:\SAP\ASE-16_0\bin;C:\SAP\ASE-16_0\dll;C:\SAP\WLA\bin;;%PATH%
set PATH=C:\SAP\ASE-16_0\jobscheduler\bin;%PATH%
set SAP_JRE8_32=C:\SAP\Shared\SAPJRE-8_1_096_32BIT
set SAP_JRE8=C:\SAP\Shared\SAPJRE-8_1_096_64BIT
set SAP_JRE8_64=C:\SAP\Shared\SAPJRE-8_1_096_64BIT
set SYBASE_OCS=OCS-16_0
set COCKPIT_JAVA_HOME=C:\SAP\Shared\SAPJRE-8_1_096_64BIT
set SYBASE=C:\SAP
set SYBASE_ASE=ASE-16_0
set SYBROOT=C:\SAP
set SYBASE_JRE_RTDS=C:\SAP\Shared\SAPJRE-8_1_096_64BIT
set SYBASE_WS=WS-16_0
set DSQUERY=HP450RK
set PYTHONHOME=C:\Program Files\Python311
set PATH=%PYTHONHOME%;%PATH%
set PYTHONPATH=%SYBASE%\%SYBASE_OCS%\python\python311_64\dll

I navigate to the %SYBASE%/%SYBASE_OCS%/sample/python directory and execute SYBASE.bat
for setting the environment. Executing results in the following error:

c:\SAP\OCS-16_0\sample\python>python %SYBASE%\%SYBASE_OCS%\sample\python\test.py
Traceback (most recent call last):
File "C:\SAP\OCS-16_0\sample\python\test.py", line 53, in <module>
import sybpydb
ImportError: DLL load failed while importing sybpydb: Das angegebene Modul wurde nicht gefunden.

The translation of the ImportError is "The specified module was not found."
I tried Python 3.11.0 and 3.11.8 installations for me only and for all users of the system. The errormessage
is allways the same.
What are I'm doing wrong?

Many thanks

Robert

View Entire Topic
robert_kratschmann
Participant
0 Kudos

I have seen the document and hopefully implement all points. I use ASE 16.0.4 PL06
and Python 3.11 instead of 3.1 (given in the document). As ASE 16.0.4 PL06 has an directory
"python311_64" I hope that Python 3.11.x is supported.

Robert

ryan_hansen
Product and Topic Expert
Product and Topic Expert

Hi,

This actually isn't a typo, but documentation that hasn't been updated for newer versions of the module.

I've created a CR or change request for these Python pages. I've found 3 pages so far.

The python modules are built with specific python versions.
Windows
%SYBASE%\%SYBASE_OCS%\python\pythonXX_64
All other platforms
$SYBASE/$SYBASE_OCS/python/pythonXX_64r

XX will be the python version that the module is built for in that directory.
So python 3.11 would use python311_64r

Hope that helps,
Ryan