Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Shaimaa
Participant
Jump to solution

Error: Python tool for exporting/importing a policy package or parts of it

Hello,

I'm trying to use the Python tool "exporting/importing a policy package"...Python version installed 2.7.14 but I'm having the following error:

Welcome to the Policy Package Import/Export Tool.
What would you like to do?
1. Import a package
2. Export a package
99. Exit
2
Please enter a Policy Package name to export:
standard
Traceback (most recent call last):
File "...ExportImportPolicyPackage-master\import_export_package.py", line 26, in <module>
args = process_arguments(arg_parser)
File "...\ExportImportPolicyPackage-master\utils.py", line 98, in process_arguments
args = Menu(args).self_args
File "...\ExportImportPolicyPackage-master\menu.py", line 21, in __init__
self.build()
File "...\ExportImportPolicyPackage-master\menu.py", line 146, in build
self.display()
File "...\ExportImportPolicyPackage-master\menu.py", line 30, in display
self.handle_input()
File "...\ExportImportPolicyPackage-master\menu.py", line 269, in handle_input
self.build()
File "...\ExportImportPolicyPackage-master\menu.py", line 146, in build
self.display()
File "...\ExportImportPolicyPackage-master\menu.py", line 30, in display
self.handle_input()
File "...\ExportImportPolicyPackage-master\menu.py", line 167, in handle_input
self.self_args.name = input()
File "<string>", line 1, in <module>
NameError: name 'standard' is not defined

 

Can anyone help to solve this error?

 

0 Kudos
1 Solution

Accepted Solutions
Felix_Hoffmann1
Participant

I know you wrote, that python2 is installed, but do you have a python3 installed too? The error you are describing comes from python2, from README.md on https://github.com/CheckPointSW/ExportImportPolicyPackage:

"The tool is developed using Python language version 2.7.9 and Check Point API Python SDK. From version 5.0 the tool is developed using Python language version 3.7."

Running it with python3 does not produce any errors.

View solution in original post

0 Kudos
(1)
8 Replies
Felix_Hoffmann1
Participant

Try to use 'Standard' with an uppercase s

0 Kudos
Shaimaa
Participant

I did but i have the same error (i used other names like test or other names), it's in the beginning of the execution...before entering the IP addresse of the management server.

I think it's related to the code

0 Kudos
Felix_Hoffmann1
Participant

I tried for my self an got the same error. It works when Standard is written in quotation marks:

Welcome to the Policy Package Import/Export Tool.
What would you like to do?
1. Import a package
2. Export a package
99. Exit
2
Please enter a Policy Package name to export:
'Standard'
Please select a login method:
1. Enter user credentials manually
2. Login as Root
3. Use an existing session file
4. Use an existing session UID
99. Back

 

0 Kudos
Shaimaa
Participant

Yes, I confirm that it's working with single quotes but i have to use the quotes for all inputs even the password.

But after entering the password with or without quotes, it exists....:

 

Please enter your password:

Traceback (most recent call last):
File "...\ExportImportPolicyPackage-master\import_expor
t_package.py", line 26, in <module>
args = process_arguments(arg_parser)
File "...\ExportImportPolicyPackage-master\utils.py", l
ine 108, in process_arguments
log_file = open(args.log_file, "w",newline='')
TypeError: 'newline' is an invalid keyword argument for this function

Apparently it dosn't take into account what is written for the password.

I think that the new version has a bug.

0 Kudos
Felix_Hoffmann1
Participant

I know you wrote, that python2 is installed, but do you have a python3 installed too? The error you are describing comes from python2, from README.md on https://github.com/CheckPointSW/ExportImportPolicyPackage:

"The tool is developed using Python language version 2.7.9 and Check Point API Python SDK. From version 5.0 the tool is developed using Python language version 3.7."

Running it with python3 does not produce any errors.

0 Kudos
(1)
Shaimaa
Participant

Yes, the problem was python version and solved by installing python 3714

 

Thanks a lot.

0 Kudos
bryanastudillo
Participant

Hi,

 

How Can I install another python version in gaia?

0 Kudos
G_W_Albrecht
Legend Legend
Legend

Why do you need to ? R81.10 latest version (SMS + GW) has:

Expert: python

Python 2.7.18 (default, Feb  2 2022, 17:14:32) 

[GCC 6.3.0] on linux2

Expert: python3

Python 3.7.7 (default, Jun 25 2021, 16:31:08) 

[GCC 6.3.0] on linux

CCSP - CCSE / CCTE / CTPS / CCME / CCSM Elite / SMB Specialist
0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events