python - qpython android IOError : [Erno 2] No such file or directory

标签 python compiler-errors python-imaging-library qpython

我正在尝试从qpython中的简单python脚本调用图像,但收到错误消息:

qpython android IOError: [Erno 2] No such file or directory

我想知道我是否使用正确的目录约定?这是代码:
import numpy as np
from PIL import Image 

spinner = {
        1: Image.open('storage/emulated/0/qpython/scripts/shapes/norm.jpg','r'),
        2: Image.open('storage/emulated/0/qpython/scripts/shapes/square.jpg','r'),
        3: Image.open('storage/emulated/0/qpython/scripts/shapes/fly.jpg','r'),
        4: Image.open('storage/emulated/0/qpython/scripts/shapes/tri.jpg','r'),
        5: Image.open('storage/emulated/0/qpython/scripts/shapes/special.jpg','r'),
        6: Image.open('storage/emulated/0/qpython/scripts/shapes/rect.jpg','r'),
        7: Image.open('storage/emulated/0/qpython/scripts/shapes/salad.jpg','r'),
        8: Image.open('storage/emulated/0/qpython/scripts/shapes/circle.jpg','r'),
        9: Image.open('storage/emulated/0/qpython/scripts/shapes/banana.jpg','r')
        }

没有'r'参数时,它将引发相同的错误。还尝试了双正向和反斜线...

最佳答案

似乎您尚未设置图像的完整路径,因此它会错过绝对路径开头的斜线。

尝试使用/storage/emulated .....而不是存储/模拟....

关于python - qpython android IOError : [Erno 2] No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46957757/

相关文章:

python - 如何在 python 中弹出子列表的内容?

scala - for 循环和范围 : found :Int required: scala. collection.generic.CanBuildFrom[Nothing,String,?] 的奇怪行为

python从原始数据创建jpg文件

python - Django 形成 HTML5 验证模式

python - django 中的 html css 示例

matlab - 将文本插入文件的功能。 Matlab的

包 fst 的 R 编译失败

python - pygtk 图像淡入

python-3.x - Python : How to turn an IMAGE into a STRING and back?

python - 从 python 脚本插入到 mysql 变量