zbarlight使用python3的正确路径是什么?

2024-09-28 20:57:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我第一次尝试运行zbarlight,我正在使用推荐的脚本。在

from PIL import Image
import zbarlight

file_path = './tests/fixtures/two_qr_codes.png'
with open(file_path, 'rb') as image_file:
    image = Image.open(image_file)
    image.load()

codes = zbarlight.scan_codes('qrcode', image)
print('QR codes: %s' % codes)

请看下面

https://pypi.python.org/pypi/zbarlight/1.0.0

但是我得到了以下错误

Traceback (most recent call last): File "/Users/JamesParsons/Dropbox/Python/carpark.py", line 6, in with open(file_path, 'rb') as image_file: FileNotFoundError: [Errno 2] No such file or directory: './tests/fixtures/two_qr_codes.png'

解决这个问题的最好办法是什么?在


Tags: pathimageimportpngwithtestsopenfixtures