- CheckMates
- :
- Products
- :
- General Topics
- :
- No module named 'cpapi' - Export policy
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No module named 'cpapi' - Export policy
I'm trying to export a policy from one CMA to another using a script available on github, but it's giving me the error below.
[Expert@MDS_MGMT-A:0]# python3 import_export_package.py -op export -d
Traceback (most recent call last):
File "import_export_package.py", line 7, in <module>
from cpapi import APIClient, APIClientArgs
ModuleNotFoundError: No module named 'cpapi'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would you mind provide github link?
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, will check tomorrow.
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just noticed below, so might be worth confirming it does not apply...
In the case you are exporting a policy package from a CMA, please verify that a global policy was NOT assigned to that CMA. The tool doesn't support exporting a policy with global policy assigned!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
The script leverages Check Points own Python SDK for communicating to the Management API. This has to be installed into your python befor using the script.
Problem here is, you are trying to use it on a Check Point host. The script seems not to be intended for usage on a Check Point host itself as the cpapi module is not installed there. As far as i remember, it is not recommended (otherwise lets say a "Don´t") to install modules into python interpreter on Check Point systems.
So, please use an external machine with installed python interpreter and the sdk module.
Installation of that module is described here:
https://github.com/CheckPointSW/cp_mgmt_api_python_sdk
for example by
pip install cp-mgmt-api-sdk
Checking, if this is installed:
to see all modules installed:
pip list
look than for cpapi or cp-mgmt-api-sdk.
depending on your system you might have different python versions installed, so you´d might have to install the module with i.e. "pip3.12" and execute the script with "python3.12" then.
hope that helps
