0
votes

I am trying to connect python to SAP by calling the Function Module RFC_READ_TABLE. I followed every steps in this link, including setting up the environment variables.

enter image description here

However, when I try to Import Pyrfc, I got an error: ImportError: DLL load failed while importing _pyrfc: The specified procedure could not be found.

enter image description here

If I set PATH=C:\nwrfcsdk\lib;C:\nwrfcsdk\bin;%PATH% manually in CMD Consule, it's working fine,

enter image description here

enter image description here

I have re-started my computer many times. Still the same issue. Could anyone help me? Thank you.

1
it may be related to the fact that you are running python through Anaconda in a virtual environment, that's why it does not "see" your pyrfc package. Try to install pyrfc in a clean Puthon - Suncatcher
hello, many thanks for your advise. the thing is I installed pyrfc-2.0.0-cp38-cp38-win_amd64.whl file in the Anaconda 'Root' path, and it seemed successfully installed. did you mean i should install this whl file in a different location? //Felix - felix12
why don't you install it through pip? pip install pyrfc --no-binary :all: - Suncatcher
I tried this, but still the same error. I have to set up environment variable manually in the CMD console: set PATH=C:\nwrfcsdk\lib;C:\nwrfcsdk\bin;%PATH% - felix12

1 Answers

0
votes

Very likely you downloaded the wrong version of PyRFC and that is why it cannot find it in the path:

https://github.com/SAP/PyRFC/issues/152

enter image description here

I got into this trap in the recent past and pulled my hairs out trying to figure out the cause why NWRFC/PyRFC is not recognized on my machine