Open ankur0101 opened 3 years ago
The temporary workaround is to install shared object files via ldconfig. I took following steps and now error has disappeared.
/root/nwrfcsdk
to /usr/local/sap/nwrfcsdk/etc/ld.so.conf.d/
and added content as /usr/local/sap/nwrfcsdk/lib
ldconfig
ldconfig -p | grep sap
which showed loaded library I think this could get addressed into library since currently I am trying to use pyrfc in SAP Cloud foundry where root access to container could not be gained and unsure how to create nwrfcsdk.conf
in /etc/ld.so.conf.d/
and run command ldconfig
via cf push
.
Credits: https://medium.com/codingtown/install-sap-nw-rfc-sdk-in-ubuntu-18-04-3-lts-50e42b4dfe66
If you look only 4 lines above the os.add_dll_directory()
statement in init.py
, there is a comment why this statement is added and relevant for Windows only.
Your main questions I think are how to deploy SAP NWRFC SDK to Cloud Foundry and how to use the PyRFC from Cloud Foundry.
Technically, SAP NWRFC SDK can be deployed using CF Pre-Runtime Hooks and PyRFC can be also deployed the standard way. The challenge is RFC channel from SAP Cloud Platform to ABAP backend, currently supported only for Java runtimes in Neo and the SAP Java Buildpack in Cloud Foundry.
For Python (and/or NodeJS) you can create the feature request for SAP Secure Cloud Connector, to enable SAP NWRFC SDK usage within SAP Cloud Platform Connectivity context and be able to use the Cloud Connector also from Python.
Please see the same question for NodeJS: https://github.com/SAP/node-rfc/issues/79
Thanks @bsrdjan for changing title 👍
To run ldconfig via cf push using .profile, it requires root level permissions since it returns Permission Denied error. I am not experienced in cloud foundry but as per my observation, I see CF installs dependencies from requirements.txt first and then triggers .profile Hence this results error saying "Environment variable SAPNWRFC_HOME not defined" even though it has been mentioned in manifest.yml as
env:
SAPNWRFC_HOME: /home/vcap/app/nwrfcsdk
Is there any way to get Shared object files uploaded before running requirments.txt?
Sorry that I can't help further with PyRFC and NWRFC SDK packaging on Cloud Foundry, without SAP NWRFC SDK being supported on Cloud Foundry. Would you mind to create a feature request for that on influence.sap.com ?
I was able to push pyrfc with NWRFC's shared object into sap cloud foundry via docker image. Thanks for your assistance @bsrdjan
The feature request to enable SAP NWRFC SDK usage on Cloud Foundry, in Connectivity context, can be created for:
Security Services
category of the SAP Cloud Platform – Platform Foundation
Here the feature request for node-rfc cloud connectivity. You may comment or vote or create similar request for PyRFC
https://github.com/SAP/node-rfc/issues/145#issuecomment-781209573
Here the current status and how to build Cloud Foundry Node.JS app with SAP NW RFC SDK:
ABAP RFC connectivity from Kyma and BTP Node.JS buildpack
It works the same way with Python: https://blogs.sap.com/2023/10/30/abap-rfc-connectivity-from-btp-python-buildpack/
Hello,
I am using Ubuntu based environment to run PyRFC. I took following steps:
export SAPNWRFC_HOME=/root/nwrfcsdk
pip3 install cython
pip3 install pynwrfc
python3
from pyrfc import Connection
This immediately gave following error message:
If I look inside init.py, I see it is trying to load SO (shared object) file as module using
os.add_dll_directory(os.path.join(os.environ["SAPNWRFC_HOME"], "lib"))
Which can be found here https://github.com/SAP/PyRFC/blob/master/src/pyrfc/init.py I am not sure this is the correct approach to load Shared object files in linux since method add_dll_directory is being called after checking OS type as nt, I could not see any check mechanism to detect unix OS type.Also please find the screenshot below for the structure of /root/nwrfcsdk
What exactly needs to be done here to get this thing working? Thanks
EDIT: I see no code for unix os types is written in this library.
I will try to push unix adaptation but I think it would be better that someone managing this repo can take care of it.