zoukankan      html  css  js  c++  java
  • neomodel 访问 neo4j 最后出现的错误

    Exception TypeError: "'NoneType' object is not callable" in <bound method Connection.__del__ of <neo4j.bolt.connection.Connection object at 0x7fd4c7420110>> ignored
    Exception TypeError: TypeError("'NoneType' object is not callable",) in <bound method DirectDriver.__del__ of <neo4j.v1.direct.DirectDriver object at 0x7fd4c7410dd0>> ignored
    Exception TypeError: "'NoneType' object is not callable" in <bound method Connection.__del__ of <neo4j.bolt.connection.Connection object at 0x7fd4c7410f50>> ignored

    应用场景是构造自己的查询语句:

    from neomodel import db

        # query = 'MATCH (a:Source{name: {n0}}) RETURN a.name, a.titleid'
        # results, columns = db.cypher_query(query, {'n0': '干旱'})
        #
        # for row in results:
        #     print str(row[0]), str(row[1])
        #
        # db.driver.close()

    解决办法: db.driver.close(),当然在什么地方增加也是有说的,如果是循环中加入会报如下错误:

    Traceback (most recent call last):
      File "/home/py/PycharmProjects/ThirdTest/questionanswer/neo4joperate.py", line 153, in <module>
        get_question_id(query, params_json_string)
      File "/home/py/PycharmProjects/ThirdTest/questionanswer/neo4joperate.py", line 127, in get_question_id
        results, columns = db.cypher_query(query_string, params_json_string)
      File "/usr/local/lib/python2.7/dist-packages/neomodel/util.py", line 28, in wrapper
        return func(self, *args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/neomodel/util.py", line 95, in cypher_query
        session = self.driver.session()
      File "/usr/local/lib/python2.7/dist-packages/neo4j/v1/direct.py", line 67, in session
        return BoltSession(self._pool.acquire, self._max_retry_time, access_mode=access_mode, bookmark=bookmark)
    AttributeError: 'NoneType' object has no attribute 'acquire'

    所以不能放在循环中。

  • 相关阅读:
    Docker-MsSqlServer和安装版本异同
    ASP.NET Core入门
    开源网站.NETMVC+ Layui+SqlSugar+RestSharp
    SqlSugar ORM已经支持读写分离
    【开源框架】SqlSugarRepository 全库ORM 正式发布
    花几分钟搭建一个自已的GIT服务器
    [开源ORM] SqliteSugar 3.x .net Core版本成功上线
    N[开源].NET CORE与MySql更配, MySqlSugar ORM框架 3.x
    Dapper ORM VS SqlSugar ORM的 8场对决
    .NET 开源SqlServer ORM框架 SqlSugar 3.0 API
  • 原文地址:https://www.cnblogs.com/herosoft/p/7905147.html
Copyright © 2011-2022 走看看