{"id":45835,"library":"products-pythonscripts","title":"Products.PythonScripts","description":"Provides support for restricted execution of Python scripts in Zope. Current version 5.2, released in 2023. Maintenance mode; occasional releases for bug fixes or compatibility updates.","status":"maintenance","version":"5.2","language":"python","source_language":"en","source_url":"https://github.com/zopefoundation/Products.PythonScripts","tags":["zope","restricted-python","python-scripts"],"install":[{"cmd":"pip install Products.PythonScripts","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Runtime dependency; PythonScripts only works within a Zope application context.","package":"Zope","optional":false}],"imports":[{"note":"PythonScript class is in a submodule, not top-level.","wrong":"from Products.PythonScripts import PythonScript","symbol":"PythonScript","correct":"from Products.PythonScripts.PythonScript import PythonScript"}],"quickstart":{"code":"from Products.PythonScripts.PythonScript import PythonScript\n# Create a PythonScript instance (requires Zope context)\n# This is typically done via Zope management interface, not standalone.\nprint('PythonScript imported successfully')","lang":"python","description":"Basic import verification. Full usage requires a Zope application server."},"warnings":[{"fix":"Upgrade Python to 3.10+ and ensure all dependencies are compatible.","message":"PythonScripts 5.x removed support for Python 2 and Python 3.9 and earlier. Requires Python >=3.10.","severity":"breaking","affected_versions":">=5.0"},{"fix":"Only import and use within a Zope application context (e.g., inside PythonScript objects in Zope management interface).","message":"PythonScripts are not standalone; they require a running Zope instance. Attempting to use them outside Zope will cause runtime errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Test scripts within Zope to confirm allowed operations. Common restrictions: no file I/O, no subprocess, limited imports.","message":"PythonScripts use a restricted execution environment (restrictedPython). Not all Python built-ins or modules are available inside a script.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'2023':17 '5.2':14 'bug':23 'compat':26 'current':12 'execut':6 'fix':24 'mainten':18 'mode':19 'occasion':20 'products.pythonscripts':1 'provid':2 'python':8,31,33 'python-script':32 'releas':15,21 'restrict':5,30 'restricted-python':29 'script':9,34 'support':3 'updat':27 'version':13 'zope':11,28","created_at":"2026-06-07T12:56:57.607162+00:00","updated_at":"2026-06-07T12:56:57.607162+00:00","problems":[{"fix":"Install with: pip install Products.PythonScripts","cause":"The package is not installed or not in Python path.","error":"ImportError: No module named Products.PythonScripts"},{"fix":"Install with: pip install Products.PythonScripts[restricted] or manually install restrictedPython.","cause":"Missing dependency restrictedPython (used for restricted execution).","error":"ModuleNotFoundError: No module named 'restrictedPython'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/zopefoundation/Products.PythonScripts","github":"https://github.com/zopefoundation/Products.PythonScripts","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}