0

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.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
felix12
  • 11
  • 4
  • 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 May 11 '21 at 06:46
  • 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 May 13 '21 at 01:09
  • why don't you install it through pip? `pip install pyrfc --no-binary :all:` – Suncatcher May 13 '21 at 06:50
  • 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 May 17 '21 at 06:21
  • try to install pyrfc 2.5. remove pyrfc 2.0 – Maneesh Jun 01 '22 at 04:34
  • Please, do not paste text as image. – Itération 122442 Jun 30 '23 at 07:34

1 Answers1

0

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

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
  • 1
    thanks! I tried again to download the SKD 64bit version. still the same error. shall i call a teams meeting with u if it's possible? – felix12 May 18 '21 at 06:30