Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
FabioLima1
Contributor

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'

0 Kudos
5 Replies
the_rock
Legend
Legend

Would you mind provide github link?

Andy

(1)
FabioLima1
Contributor

0 Kudos
the_rock
Legend
Legend

Thanks, will check tomorrow.

Andy

0 Kudos
the_rock
Legend
Legend

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!

(1)
Nüüül
Advisor

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

 

(1)

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events