SAP / PyRFC

Asynchronous, non-blocking SAP NW RFC SDK bindings for Python
http://sap.github.io/PyRFC
Apache License 2.0
501 stars 133 forks source link

DLL load failed: %1 is not a valid Win32 application. #41

Closed kamalelsaaid closed 7 years ago

kamalelsaaid commented 7 years ago

My problem: I am trying to contact SAP with python using the PYRFC on windows. I am using Python3.4 AMD 64 - win 64, and I have followed these instructions web pages. this and this also but after I have finished all instructions, I tried to import PYRFC in python, but I got this issue. My Issue:

ImportError: DLL load failed: %1 is not a valid Win32 application.

(Windows) This error occurs when SAP NW RFC Library 64bit version is installed on a system with 32bit version Python.

I don't know why I got this issues as I am running on a 64bit version python and 64bit version SAP NW RFC Library. So, Is the problem that I am using python3.4 and this mean I have to use python2.7 or should I change my version to 32bit version instead of 64 ?

bsrdjan commented 7 years ago

Is Visual C++ Redistributable for Visual Studio 2015 installed, like described in README - recently updated per issue #19 feedback ? Python 3.4 shall work on 64 bit, no need for 32 bit.

kamalelsaaid commented 7 years ago

@bsrdjan Thank you for your response, yes, I have already installed the Visual C++ Redistributable, I have installed the 2015. What should I do next, I tried many things, is there any another cases that may case this error. Should I try to run python 32bit and reinstall pyrfc with 32bit

kamalelsaaid commented 7 years ago

Okay, I found a solution. I should type the following command as this is the command related to version 64 bit SAPCAR_315-20010451.EXE -xvf NWRFC_24-20004568.SAR I am not sure but what I have made is type that command and tried also this command for 32bit version SAPCAR_315-20010451.EXE -xvf NWRFC_24-20004566.SAR SAPCAR_315-20010451.EXE -xvf NWRFC_24-20004563.SAR and it finally worked.

bsrdjan commented 7 years ago

Glad the issue is solved, these filenames are not easy to deal with.

For such kind of errors, there are test programs in nwrfcsdk/lib folder, like rfcexec.exe for example, to verify that sapnwrfc sdk is correctly installed. The troubleshooting can start from there.