小编Abd*_*dul的帖子

为Mac安装ext-zip

我正在尝试运行作曲家更新,出现以下错误

Problem 1
    - The requested PHP extension ext-zip * is missing from your system. Install or enable PHP's zip extension.
  Problem 2
    - maatwebsite/excel 3.1.10 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.11 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.12 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.13 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, …
Run Code Online (Sandbox Code Playgroud)

macos laravel composer-php macos-catalina

19
推荐指数
6
解决办法
7529
查看次数

通过Python中的JSON数组循环

我从API获取以下数据.我试图使用Python脚本访问餐厅名称并让脚本显示它.这是我的文件:

test.py

with open('data.json') as data_file:    
    data = json.load(data_file)
    for restaurant in data:
        print data ['restaurants'][0]['restaurant']['name']
Run Code Online (Sandbox Code Playgroud)

我的JSON文件如下:(简化)

    {
  "results_found": 3296,
  "results_start": 0,
  "results_shown": 20,
  "restaurants": [
    {
      "restaurant": {
        "R": {
          "res_id": 9101083
        },
        "id": "9101083",
        "name": "My Meat Wagon",
          "address": "Market Square, Smithfield, Dublin Dublin 7",
          "locality": "Smithfield",
          "city": "Dublin",
          "city_id": 91,
          "latitude": "53.3489980000",
          "longitude": "-6.2788120000",
          "zipcode": "Dublin 7",
        "events_url": "https://www.zomato.com/dublin/my-meat-wagon-smithfield/events#tabtop?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1",
        "establishment_types": []
      }
    },
    {
      "restaurant": {
        "R": {
          "res_id": 9101628
        },
        "id": "9101628",
        "name": "Wowburger",
        "url": "https://www.zomato.com/dublin/wowburger-temple-bar?utm_source=api_basic_user&utm_medium=api&utm_campaign=v2.1", …
Run Code Online (Sandbox Code Playgroud)

python json

5
推荐指数
2
解决办法
3万
查看次数

过滤查询,然后使用 SQLAlchemy 按 id 获取一行

我只想通过 id 获取用户,如果他们没有deleted=0. 我试过

user = User.query.filter_by(deleted=0).get(id)
Run Code Online (Sandbox Code Playgroud)

但出现错误。如何过滤查询并通过 id 获取?

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/david/.virtualenvs/flask-sqlalchemy/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 831, in get
    return self._get_impl(ident, loading.load_on_ident)
  File "/home/david/.virtualenvs/flask-sqlalchemy/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 864, in _get_impl
    return fallback_fn(self, key)
  File "/home/david/.virtualenvs/flask-sqlalchemy/lib/python3.6/site-packages/sqlalchemy/orm/loading.py", line 177, in load_on_ident
    q._get_condition()
  File "/home/david/.virtualenvs/flask-sqlalchemy/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 350, in _get_condition
    "get", order_by=False, distinct=False)
  File "/home/david/.virtualenvs/flask-sqlalchemy/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 368, in _no_criterion_condition
    self._no_criterion_assertion(meth, order_by, distinct)
  File "/home/david/.virtualenvs/flask-sqlalchemy/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 365, in _no_criterion_assertion
    "Query with existing criterion. " % meth)
sqlalchemy.exc.InvalidRequestError: …
Run Code Online (Sandbox Code Playgroud)

python sqlalchemy

3
推荐指数
1
解决办法
4535
查看次数