Coder Social home page Coder Social logo

Comments (6)

lorenzznerol avatar lorenzznerol commented on August 24, 2024

This is perhaps not yet solved?
bson.BSON(item_data).decode()
gives me
AttributeError: module 'bson' has no attribute 'BSON' using bson 0.5.10

from bson.

Parkayun avatar Parkayun commented on August 24, 2024

see mongodb's bson module

from bson.

lorenzznerol avatar lorenzznerol commented on August 24, 2024

Thank you, it might have been a stupid question. It was and is confusing that both pymongo and bson packages need the same import bson statement when you want to read bson. If you have both bson and pymongo installed, import bson will only import the pymongo version (e.g. bson.loads() is not accessible, thus the bson packages are not merged together). You would need to uninstall pymongo just to get the import bson from here again and not the pymongo import bson package. For those who need pymongo: https://pypi.org/project/pymongo/

from bson.

Parkayun avatar Parkayun commented on August 24, 2024

I'm testing another name pybson. you can install and use that name.

from bson.

lorenzznerol avatar lorenzznerol commented on August 24, 2024

I have used pip uninstall bson and pip install pybson now so that I can use import pybson as bson when I want the old name back. If I accidentally need both pymongo's and pybson's import bson, I can use aliases. Thanks.

from bson.

lorenzznerol avatar lorenzznerol commented on August 24, 2024

I have installed a new system, using anaconda as the base. In Spyder, even though I had installed bson using pip install pybson, it said:

Traceback (most recent call last):

File "", line 1, in
import pybson # same as bson

File "C:\Users\Admin\anaconda3\lib\site-packages\pybson_init_.py", line 23, in
from .objectid import ObjectId

File "C:\Users\Admin\anaconda3\lib\site-packages\pybson\objectid.py", line 30, in
from bson.py3compat import PY3, bytes_from_hex, string_type, text_type

ModuleNotFoundError: No module named 'bson'

After installing pymongo in addition to pybson, using conda install pymongo, the import pybson statement worked. Why?

from bson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.