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

Python 3 NameError: name 'unicode' is not defined #16

Closed
vfr292 opened this issue May 25, 2018 · 3 comments
Closed

Python 3 NameError: name 'unicode' is not defined #16

vfr292 opened this issue May 25, 2018 · 3 comments

Comments

@vfr292
Copy link

vfr292 commented May 25, 2018

Hi,

I'm getting an error while runnign a flask app in python 3.6.4 with the following config:

    from kombu_fernet.serializers.pickle import MIMETYPE
    CELERY_TASK_SERIALIZER = 'fernet_pickle'
    CELERY_RESULT_SERIALIZER = 'fernet_pickle'
    CELERY_ACCEPT_CONTENT = [MIMETYPE]

Below is the erorr, its looking for unicode which isn't global in python3. Chaning the line to

if isinstance(encoded_message, str):

Solved the issue.

Full error:

11:17:56 web.1   |  [2018-05-25 11:17:56,027: INFO/MainProcess] Received task: car_listing_flask_app.blueprints.general_info.views.wait_and_add_background_task[d8c098d6-3881-4dce-9348-8e898a39464e]  
11:17:56 web.1   |  [2018-05-25 11:17:56,045: ERROR/MainProcess] Pool callback raised exception: DecodeError(NameError("name 'unicode' is not defined",),)
11:17:56 web.1   |  Traceback (most recent call last):
11:17:56 web.1   |    File "/Users/V/Documents/Python/Car_Listing_Project/venv_car_listing_project/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
11:17:56 web.1   |      return obj.__dict__[self.__name__]
11:17:56 web.1   |  KeyError: 'chord'
11:17:56 web.1   |  During handling of the above exception, another exception occurred:
11:17:56 web.1   |  Traceback (most recent call last):
11:17:56 web.1   |    File "/Users/V/Documents/Python/Car_Listing_Project/venv_car_listing_project/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
11:17:56 web.1   |      return obj.__dict__[self.__name__]
11:17:56 web.1   |  KeyError: '_payload'
11:17:56 web.1   |  During handling of the above exception, another exception occurred:
11:17:56 web.1   |  Traceback (most recent call last):
11:17:56 web.1   |    File "/Users/V/Documents/Python/Car_Listing_Project/venv_car_listing_project/lib/python3.6/site-packages/kombu/serialization.py", line 50, in _reraise_errors
11:17:56 web.1   |      yield
11:17:56 web.1   |    File "/Users/V/Documents/Python/Car_Listing_Project/venv_car_listing_project/lib/python3.6/site-packages/kombu/serialization.py", line 263, in loads
11:17:56 web.1   |      return decode(data)
11:17:56 web.1   |    File "/Users/V/Documents/Python/Car_Listing_Project/venv_car_listing_project/lib/python3.6/site-packages/kombu_fernet/serializers/__init__.py", line 16, in inner
11:17:56 web.1   |      if isinstance(encoded_message, unicode):
11:17:56 web.1   |  NameError: name 'unicode' is not defined
@vfr292
Copy link
Author

vfr292 commented May 25, 2018

Hi, I'm thinking that the pypi package https://pypi.org/project/kombu-fernet-serializers/ hasn't been updated for python3? I'm following the notes here:
https://blog.heroku.com/securing-celery
And I'm seeing that the package code doesn't match this Git repository code.

Thanks,

~Victor

@pcraciunoiu
Copy link

pcraciunoiu commented Sep 17, 2018

Yep, you can install from GitHub and it works:
pip install git+git://github.com/heroku/kombu-fernet-serializers.git@v0.1.0#egg=kombu_fernet_serializers

@iamjem @lambacck @dgouldin any chance you can push v0.1.0 to pypi?

Edit: worth adding that the JSON serializer doesn't work either. So the latest pypi version is not very useful on python3...

@lambacck
Copy link
Contributor

lambacck commented Jul 6, 2020

version 0.1.0 is released to pypi.

@lambacck lambacck closed this as completed Jul 6, 2020
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

3 participants