1

I want to connect a python script to SAP. Therefore I use pyrfc which is developed by SAP https://github.com/SAP/PyRFC/.

This works on my local computer, as I followed the installation description: (http://sap.github.io/PyRFC/install.html#sap-nw-rfc-sdk-installation):

Windows

Create the SAP NW RFC SDK home directory, e.g. c:\nwrfcsdk

Set the SAPNWRFC_HOME env variable: SAPNWRFC_HOME=c:\nwrfcsdk

Unpack the SAP NW RFC SDK archive to it, e.g. c:\nwrfcsdk\lib shall exist.

Include the lib directory to the library search path on Windows, i.e. extend >the PATH environment variable.

Add c:\nwrfcsdk\lib to PATH.

Now I wanted to see, if this also can work on pythonanywhere.com to later maybe develop a Django App.

Therefore I uploaded the SAP NW RFC SDK to pythonanywhere and set the SAPNWRFC_Home env variable to the corresponding python anywhere folder:

echo SAPNWRFC_HOME=/home/Buddhagoes/nwrfcsdk/

This didn't work.

I also tried to set the path dynamically in the python Script itself. Without success :-(

import sys

print(sys.path)

['', '/home/Buddhagoes/.local/lib/python2.7/site-packages', 
'/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', 
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', 
usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', 
'/usr/local/lib/python2.7/dist-packages/Orange/orng', 
/usr/lib/python2.7/dist-packages','/usr/lib/python2.7/dist-packages/wx- 
3.0-gtk2']

sys.path += ["/home/Buddhagoes/nwrfcsdk/lib"]    
                                                                                  
sys.path
['', '/home/Buddhagoes/.local/lib/python2.7/site-packages', 
'/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', 
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', 
'/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist- 
packages', '/usr/local/lib/python2.7/dist-packages/Orange/orng', 
'/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/wx- 
3.0-gtk2', '/home/Buddhagoes/nwrfcsdk/lib']

from pyrfc import Connection

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/Buddhagoes/.local/lib/python2.7/site- 
packages/pyrfc/__init__.py", line 22, in <module>
from pyrfc._pyrfc import get_nwrfclib_version, Connection, 
TypeDescription, FunctionDescription, Server
ImportError: libsapnwrfc.so: cannot open shared object file: No such file 
or directory

It would mean a tremendous progress in my relatively short programming career if a hosted Python script could communicate with our SAP system, yet I am stuck at this point :-(

Any help would be highly appreciated.

Thank you

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Florian
  • 11
  • 1
  • 2
    PythonAnywhere is not a Windows environment, installing Windows software on it will not work. – Glenn Oct 30 '19 at 12:04

0 Answers0