{"id":24385,"library":"pyrfc","title":"pyrfc - SAP NetWeaver RFC Bindings","description":"pyrfc provides Python bindings for SAP NetWeaver RFC SDK, enabling remote function calls to SAP systems. Version 3.3.1 supports Python >=3.8. Active maintenance with periodic releases.","status":"active","version":"3.3.1","language":"python","source_language":"en","source_url":"https://github.com/SAP/PyRFC","tags":["sap","rfc","erp","nwrfc"],"install":[{"cmd":"pip install pyrfc","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"SAP NetWeaver RFC SDK library (required at runtime)","package":"sapnwrfc","optional":false},{"reason":"WebSocket support (optional)","package":"python-socketio","optional":true}],"imports":[{"note":"Main connection class since v2.0","symbol":"Connection","correct":"from pyrfc import Connection"}],"quickstart":{"code":"from pyrfc import Connection\n\nconn = Connection(\n    ashost='<host>',\n    sysid='<sysid>',\n    client='<client>',\n    user=os.environ.get('SAP_USER', '<user>'),\n    passwd=os.environ.get('SAP_PASS', '<password>'),\n    lang='EN'\n)\n\nresult = conn.call('RFC_READ_TABLE', QUERY_TABLE='T001', ROWCOUNT=10)\nfor row in result['DATA']:\n    print(row['WA'])\n\nconn.close()","lang":"python","description":"Connect to SAP, call RFC_READ_TABLE, and print results."},"warnings":[{"fix":"Use from pyrfc import Connection and instantiate Connection object.","message":"pyrfc 2.0 introduced Connection class replacing direct module functions. Old code using pyrfc.connect() will break.","severity":"breaking","affected_versions":">=2.0"},{"fix":"Explicitly call conn.close() or use a context manager if available (not yet built-in in 3.x). Keep a reference to the connection until done.","message":"GC side-effect: assigning a Connection instance to a local variable and letting it go out of scope may cause segfault (the C extension destructor triggers GC of the native SDK).","severity":"gotcha","affected_versions":"all"},{"fix":"Use raw strings or escape quotes properly. Pass password via environment variable to avoid shell interpolation.","message":"Password with special characters (especially single quotes) can cause syntax errors or connection failures.","severity":"gotcha","affected_versions":"all"},{"fix":"Use saprfc.ini configuration file for SSL settings. See pyrfc documentation for details.","message":"pyrfc 2.x deprecated ssl parameters (e.g., ssl_sni, ssl_sni_disable) in favor of a unified saprfc ini file approach.","severity":"deprecated","affected_versions":">=2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install SAP NW RFC SDK (available from SAP) and set LD_LIBRARY_PATH (Linux) or PATH (Windows) to include the SDK's lib folder.","cause":"SAP NetWeaver RFC SDK (librfccm.so / sapnwrfc.dll) is not installed or not on the library path.","error":"pyrfc._pyrfc.ConnectionError: Module sapnwrfc.so not found"},{"fix":"Use 'from pyrfc import Connection' (note the capital C).","cause":"User attempts to import from old package pattern (e.g., import pyrfc and then pyrfc.Connection) but module structure changed.","error":"ImportError: cannot import name 'Connection' from 'pyrfc'"},{"fix":"Ensure conn.close() is called before discarding the reference, and don't share connections across threads without proper synchronization.","cause":"As explained in warnings: Python garbage collector releases the native SDK handle while still in use.","error":"RuntimeError: GC caused segfault in pyrfc. Connection was garbage collected while still being used by another thread."},{"fix":"Double-check all connection parameters. Ensure ASHOST is correct and the SAP gateway is accessible.","cause":"Invalid or missing connection parameters (host, sysid, client, user, passwd).","error":"pyrfc._pyrfc.ConnectionError: RFC_INVALID_PARAMETER (rc=4)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}