bencode.py icon indicating copy to clipboard operation
bencode.py copied to clipboard

AttributeError: 'module' object has no attribute 'encode'

Open IsmailM opened this issue 8 years ago • 2 comments

Hey,

I'm having some difficulty in getting bencode working:


pip install bencode.py
import bencode

bencode.encode({'title': 'Example'})

# ---------------------------------------------------------------------------
# AttributeError                            Traceback (most recent call last)
# <ipython-input-17-f26380d80be9> in <module>()
#       3 import bencode
#       4 
# ----> 5 bencode.encode({'title': 'Example'})

# AttributeError: 'module' object has no attribute 'encode'

I would really appreciate a pointer in where I'm going wrong.

Btw, I'm using Python 2.7.10.

IsmailM avatar Feb 27 '17 13:02 IsmailM

This is probably caused by a conflicting package that is using the same module name.

All these packages use the same module name (so only one can be installed):

  • https://pypi.python.org/pypi/bencode
  • https://pypi.python.org/pypi/BitTorrent-bencode
  • https://pypi.python.org/pypi/bencode-parser
  • https://pypi.python.org/pypi/python-bencode

I'm thinking it might be best to change the name of the package to avoid conflicts with these other existing packages...

fuzeman avatar Feb 28 '17 23:02 fuzeman

@IsmailM pip install bencode.py should resolve the package conflict (assuming you uninstall all bencodes before).

ExSidius avatar Apr 29 '19 20:04 ExSidius