intel-screenbot

An Ingress Intel Map Bot for Hangoutsbot
git clone git://archive.git.mtrnord.blog/MTRNord/intel-screenbot.git
Log | Files | Refs | README | LICENSE

commit bd7501322f35905be8cd8ffa73bc4948fcc9fe65
parent 5bd3bf3233d7c962ea9eacd6e4a751c13a5de059
Author: Marcel <MTRNord@users.noreply.github.com>
Date:   Mon, 13 Feb 2017 20:39:17 +0100

Try opening file correct
Diffstat:
M__init__.py | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/__init__.py b/__init__.py @@ -15,8 +15,8 @@ def _initialise(bot): @asyncio.coroutine -def _open_file(name): - return open(name, 'rb') +def _open_file(name, otype): + return open(name, otype) @asyncio.coroutine def readline(f): @@ -96,7 +96,7 @@ def _screencap(url, args_filepath, filepath, filename, bot, event, arguments): # read the resulting file into a byte array # yield from asyncio.sleep(10) if (arguments['screenshotfunction'] != 'portalinfoText'): - file_resource = yield from _open_file(filepath) + file_resource = yield from _open_file(filepath, 'rb') file_data = yield from loop.run_in_executor(None, file_resource.read) image_data = yield from loop.run_in_executor(None, io.BytesIO, file_data) if status: @@ -113,7 +113,8 @@ def _screencap(url, args_filepath, filepath, filename, bot, event, arguments): yield from bot.coro_send_message(event.conv_id, "<i>error uploading screenshot</i>") else: if status: - response = yield from readline(arguments['portalinfoResponse']) + response_file = yield from _open_file(arguments['portalinfoResponse'], 'r') + response = yield from readline(response_file) logger.info('Got: {!r}'.format(response)) yield from bot.coro_send_message(event.conv.id_, '{!r}'.format(response))