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 Support? #17

Closed
cdeil opened this issue Dec 9, 2014 · 8 comments
Closed

Python 3 Support? #17

cdeil opened this issue Dec 9, 2014 · 8 comments

Comments

@cdeil
Copy link

cdeil commented Dec 9, 2014

Does this Bunch implementation support Python 3?

I get some test errors with Python 3.4:
https://gist.github.com/cdeil/5525c1ee193f1426ee8b

And Python 3 support is not listed via the setup.py classifiers:
https://pypi.python.org/pypi/bunch/

If it doesn't support Python 3, could you please state this in the README?

@cdeil
Copy link
Author

cdeil commented Dec 9, 2014

I've found this fork by @redodo:
https://github.com/redodo/lunch
https://pypi.python.org/pypi/lunch

But it also gives test errors on Python 3:
https://gist.github.com/cdeil/fe6c116791c36b980dd1
and has the disadvantage that the lunch package on PyPI installs itself as bunch in site-packages, which is confusing.

@dsc Would you consider making a new bunch release if someone makes a pull request that give simultaneous Python 2 / 3 support?

@femtotrader
Copy link

I'm also looking for Python 3 support.

@iaintshine
Copy link

👍

@fpn
Copy link

fpn commented Jul 14, 2015

+1 (AttributeError: 'dict' object has no attribute 'iteritems') in bunchify(x)

@candlerb
Copy link

Even Bunch.repr() is broken on python3:

$ python3
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from bunch import Bunch
>>> a = Bunch(foo=123, bar=456)
>>> a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/workflow/venv/lib/python3.5/site-packages/bunch/__init__.py", line 200, in __repr__
    keys.sort()
AttributeError: 'dict_keys' object has no attribute 'sort'
>>>

This is because the keys() method in python3 returns an iterator (like iterkeys() in python2).

Solution: list(whatever.keys())

@femtotrader
Copy link

You might use Munch (from @vmalloc) instead of Bunch https://github.com/Infinidat/munch
see #32

@candlerb
Copy link

Thanks, I have switched to Munch now. It works fine, except I keep typing Much by accident :-)

@olivecoder
Copy link
Contributor

I submitted the fixes for that and my fork is already fixed https://github.com/olivecoder/bunch

tchaikov added a commit to tchaikov/s3-tests that referenced this issue Dec 27, 2019
see dsc/bunch#17

Signed-off-by: Kefu Chai <kchai@redhat.com>
@dsc dsc closed this as completed Sep 20, 2024
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

7 participants