bencode.py
bencode.py copied to clipboard
AttributeError: 'module' object has no attribute 'encode'
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.
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...
@IsmailM pip install bencode.py should resolve the package conflict (assuming you uninstall all bencodes before).