阅读背景:

为什么我的Python脚本不能识别导入模块中的类?

来源:互联网 

collection.py

import sys
import os
import pymongo
from pymongo import MongoClient

class Collection():
    """returns a collection curser from mongodb"""

    client = MongoClient()

    def __init__(self, db, collection_name):
        self.db = db
        self.collection_name = collection_name

    def getCollection(self):
        data_base = getattr(self.client, self.db)
        collObject = getattr(data_base, self.collection_name)
        return collObject
import sys
import os
import pym



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: