Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Error in Classify Image

未关闭
#22 0 条评论 0 个 reaction 已指派 2 人 在 GitHub 查看

@john-matroid 已经在做这个了。

开始于 2025年3月28日。

评估

这个 Issue 还没有评估数据。

描述

When running the following code:

import json
import os
from matroid.client import Matroid

api = Matroid(client_id='XXX', client_secret='XXX')

folder = "/Users/alex/Downloads/frames"
files = [os.path.join(folder, f) for f in os.listdir(folder)]

# Process files in batches of 5
batch_size = 5
results = []

for i in range(0, len(files), batch_size):
    batch = files[i:i + batch_size]
    batch_result = api.classify_image(detectorId='67ca12fa78705347cded7b1e', file=batch)
    results.extend(batch_result)

with open("results.json", "w") as f:
    json.dump(results, f, indent=4)

I had this error:

Traceback (most recent call last):
  File "/Users/alex/temp1/temp/lib/python3.13/site-packages/matroid/src/images.py", line 36, in classify_image
    return batch_file_request(file, method, endpoint, headers, data)
  File "/Users/alex/temp1/temp/lib/python3.13/site-packages/matroid/src/helpers.py", line 116, in batch_file_request
    % (bytes_to_mb(MAX_LOCAL_IMAGE_BATCH_SIZE))
       ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: bytes_to_mb() missing 1 required positional argument: 'bytes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/alex/temp1/get_annotations.py", line 15, in <module>
    batch_result = api.classify_image(detectorId='67ca12fa78705347cded7b1e', file=batch)
  File "/Users/alex/temp1/temp/lib/python3.13/site-packages/matroid/src/helpers.py", line 18, in setup_and_teardown
    response = func(self, *original_args, **original_kwargs)
  File "/Users/alex/temp1/temp/lib/python3.13/site-packages/matroid/src/images.py", line 46, in classify_image
    raise error.APIConnectionError(message=e)
matroid.error.APIConnectionError: bytes_to_mb() missing 1 required positional argument: 'bytes'
主要语言
Python
星标
18
派生
5
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

matroid/matroid-python 的其他 Issue

查看 matroid/matroid-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。