Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

图片转发失败。。。感觉coolq图片的API 好像改变了 #35

Closed
a-wing opened this issue Mar 25, 2018 · 4 comments
Closed

图片转发失败。。。感觉coolq图片的API 好像改变了 #35

a-wing opened this issue Mar 25, 2018 · 4 comments

Comments

@a-wing
Copy link

a-wing commented Mar 25, 2018

[telegram.bot][DEBUG] (bot.py:61): True
[telegram.bot][DEBUG] (bot.py:62): Exiting: set_webhook
[telegram.bot][DEBUG] (bot.py:59): Entering: get_updates
[CTBMain.utils][DEBUG] (utils.py:458): qq -> tg: [{'data': {'file': '39F2F3683FD4DD4A448DA4684C313ACF.jpg', 'url': 'https://gchat.qpic.cn/gchatpic_new/1203120914/701311009-2792625372-39F2F3683FD4DD4A448DA4684C313ACF/0?vuin=2776926981&term=2'}, 'type': 'image'}]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/home/user/coolq-telegram-bot/cqhttp/__init__.py", line 118, in _handle
    result = handler(request.json)
  File "/home/user/coolq-telegram-bot/cqhttp/__init__.py", line 63, in wrapper
    return func(*args, **kwargs)
  File "/home/user/coolq-telegram-bot/plugins/_1100_text_forward.py", line 571, in handle_forward
    qq_user=context['user_id'])
  File "/home/user/coolq-telegram-bot/utils.py", line 483, in send_from_qq_to_tg
    cq_get_pic_url(filename)
  File "/home/user/coolq-telegram-bot/cq_utils.py", line 184, in cq_get_pic_url
    url = parser['image']['url']
  File "/usr/lib/python3.6/configparser.py", line 959, in __getitem__
    raise KeyError(key)
KeyError: 'image'
127.0.0.1 - - [25/Mar/2018 13:52:24] "POST / HTTP/1.1" 500 741
@jqqqqqqqqqq
Copy link
Member

Fixed, please try try

@a-wing
Copy link
Author

a-wing commented Mar 26, 2018

难道咱俩用的版本不一样?

图片储存的貌似也变了

[CTBMain.utils][DEBUG] (utils.py:460): qq -> tg: [{'data': {'file': '39F2F3683FD4DD4A448DA4684C313ACF.jpg', 'url': 'https://gchat.qpic.cn/gchatpic_new/1203120914/701311009-2792625372-39F2F3683FD4DD4A448DA4684C313ACF/0?vuin=2776926981&term=2'}, 'type': 'image'}]
[CTBMain.cq_utils][DEBUG] (cq_utils.py:185): downloading file to /home/metal/coolq/data/image/39F2F3683FD4DD4A448DA4684C313ACF.jpg
[CTBMain.cq_utils][ERROR] (cq_utils.py:190): {'image': '39F2F3683FD4DD4A448DA4684C313ACF.jpg', 'url': 'https://gchat.qpic.cn/gchatpic_new/1203120914/701311009-2792625372-39F2F3683FD4DD4A448DA4684C313ACF/0?vuin=2776926981&term=2'}
Traceback (most recent call last):
  File "/home/user/coolq-telegram-bot/main/cq_utils.py", line 187, in cq_download_pic
    urlretrieve(cq_image['url'], path)
  File "/usr/lib/python3.6/urllib/request.py", line 258, in urlretrieve
    tfp = open(filename, 'wb')
FileNotFoundError: [Errno 2] No such file or directory: '/home/metal/coolq/data/image/39F2F3683FD4DD4A448DA4684C313ACF.jpg'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/home/user/coolq-telegram-bot/cqhttp/__init__.py", line 118, in _handle
    result = handler(request.json)
  File "/home/user/coolq-telegram-bot/cqhttp/__init__.py", line 63, in wrapper
    return func(*args, **kwargs)
  File "/home/user/coolq-telegram-bot/plugins/_1100_text_forward.py", line 640, in handle_forward
    qq_user=context['user_id'])
  File "/home/user/coolq-telegram-bot/main/utils.py", line 484, in send_from_qq_to_tg
    pic = open(image_path, 'rb')
TypeError: expected str, bytes or os.PathLike object, not NoneType
127.0.0.1 - - [26/Mar/2018 02:44:33] "POST / HTTP/1.1" 500 741

没这个文件/home/metal/coolq/data/image/39F2F3683FD4DD4A448DA4684C313ACF.jpg

文件是

root@b666662e13af:/home/user/coolq-telegram-bot# cat ../coolq/data/image/39F2F3683FD4DD4A448DA4684C313ACF.jpg.cqimg 
[image]
md5=39F2F3683FD4DD4A448DA4684C313ACF
width=719
height=572
size=148169
url=https://gchat.qpic.cn/gchatpic_new/1203120914/701311009-2792625372-39F2F3683FD4DD4A448DA4684C313ACF/0?vuin=2776926981&term=2
addtime=1521985944

@jqqqqqqqqqq
Copy link
Member

用 docker 的话,路径 CQ_ROOT 不用改,用默认的就好,即 '/home/user/coolq/'

@a-wing
Copy link
Author

a-wing commented Mar 26, 2018

原来是这样。。谢谢

@a-wing a-wing closed this as completed Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants