Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError #16

Open
thefretrunner opened this issue Feb 6, 2021 · 2 comments
Open

UnicodeEncodeError #16

thefretrunner opened this issue Feb 6, 2021 · 2 comments

Comments

@thefretrunner
Copy link

I get an error when running the import:

2021-02-06 14:12:29,837 :: DEBUG :: Processing errata CESA-2016:0372
2021-02-06 14:12:29,837 :: DEBUG :: Working on OS release 7
2021-02-06 14:12:29,837 :: DEBUG :: Packages list for errata CESA-2016:0372 for OS release 7: ['openssl098e-0.9.8e-29.el7.centos.3.i686.rpm', 'openssl098e-0.9.8e-29.el7.centos.3.x86_64.rpm']
2021-02-06 14:12:29,837 :: DEBUG :: Working on repository Centos_7_base_x86_64
Traceback (most recent call last):
File "./centos-errata-katello-importer.py", line 223, in
subprocess.call(pulp_cmd)
File "/usr/lib64/python3.6/subprocess.py", line 287, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib64/python3.6/subprocess.py", line 729, in init
restore_signals, start_new_session)
File "/usr/lib64/python3.6/subprocess.py", line 1295, in _execute_child
restore_signals, start_new_session, preexec_fn)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 2440: ordinal not in range(128)

@thefretrunner
Copy link
Author

thefretrunner commented Feb 6, 2021

I don't know how to do pull requests but the fix is quite simple.

Change line 208 in centos-errata-katello-importer.py to:

pulp_cmd.append('--description=' + str(errata.get_description().encode('utf-8')))

Basically convert unicode to ascii using utf-8 encode and cast to str()

At least it works fine for me.

@thefretrunner
Copy link
Author

Looking more in the code I can see the description of the errata never gets imported. It is hardcoded to N/A. Any reason for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant