質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

0回答

1847閲覧

Heroku エラー

sinozima

総合スコア10

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2019/02/04 07:46

前提・実現したいこと

出てきているエラーの解決方法がわからないです
寮のメニューを教えてくれるTwitterbotを作ってherokuにpushしてherku run python ****** で実行したときにエラーが出ました

発生している問題・エラーメッセージ

Traceback (most recent call last): File "/app/.heroku/python/lib/python3.6/site-packages/pdf2image/pdf2image.py", line 182, in _page_count proc = Popen(["pdfinfo", pdf_path], stdout=PIPE, stderr=PIPE) File "/app/.heroku/python/lib/python3.6/subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "/app/.heroku/python/lib/python3.6/subprocess.py", line 1344, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'pdfinfo': 'pdfinfo' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "downlod.py", line 73, in <module> images = convert_from_path('test.pdf') File "/app/.heroku/python/lib/python3.6/site-packages/pdf2image/pdf2image.py", line 46, in convert_from_path page_count = _page_count(pdf_path, userpw) File "/app/.heroku/python/lib/python3.6/site-packages/pdf2image/pdf2image.py", line 186, in _page_count raise PDFInfoNotInstalledError('Unable to get page count. Is poppler installed and in PATH?') pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?

該当のソースコード

Python
import urllib.request
import os
import tweepy
from pdf2image import convert_from_path
from PIL import Image
from pytz import timezone
from datetime import datetime

map_x_front = [540,780,1023,1265,1510,1750,1993]
map_x_back = [775,1015,1259,1500,1745,1985,2228]
map_y_a_front = [428,790,1140]
map_y_a_back = [543,840,1190]
map_y_b_front = [615,907,1270]
map_y_b_back = [718,970,1330]

now = datetime.now(timezone('Asia/Tokyo'))
week = now.weekday()
now = str(now)
time = now[11:13]
date = now[8:10]
month = now[5:7]
year = now[0:4]
yera = int(year)
month = int(month)
time = int(time)
date = int(date)
print(now)
if time <= 7:
time_food = 0
elif time <= 12:
time_food=1
else:
time_food=2
if 0>= date - week:
month=month-1
if month-1 == 1 or month-1 == 3 or month -1 == 5 or month -1 == 7 or month -1 ==8 or month -1 == 10 or month-1 == 0:
url_date = date-week+31
elif month-1!=2:
url_date = date-week+30
else:
if year % 4 == 0 and year % 100 != 0:
url_date = date-week+29
elif year % 400 == 0:
url_date = date-week+29
else:
url_date = date-week+28
print(url_date)

if month>=10:
month_str=str(month)
else:
month_str = '0{0}'.format(str(month))

if url_date>=10:
date_str=str(url_date)
else:
date_str = '0{0}'.format(str(url_date))

print(month_str)
print(date_str)

url = 'http://www.tsuyama-ct.ac.jp/imgVer4/hokushinryou/menu/ryoumenu-H31{0}{1}.pdf'.format(month_str,date_str)
savename="test.pdf"
urllib.request.urlretrieve(url,savename)
print("adae")

images = convert_from_path('test.pdf')
print("afa")
images[0].save('test.png','png')
im = Image.open('test.png')
im_crop = im.crop((map_x_front[week],map_y_a_front[time_food],map_x_back[week],map_y_a_back[time_food]))
im_crop2 = im.crop((map_x_front[week],map_y_b_front[time_food],map_x_back[week],map_y_b_back[time_food]))
im_crop.save("test2.png",quality=95)
im_crop2.save("test3.png",quality=95)

im1 = Image.open('test2.png')
im2 = Image.open('test3.png')

dst = Image.new('RGB', (im1.width, im1.height + im2.height))

dst.paste(im1, (0, 0))
dst.paste(im2, (0, im1.height))
dst.save('test4.png')

message=""
print("保存しました")

試したこと

翻訳したりググったりしたのですが、分かりませんでした。
よろしくお願いしますm(_ _)m

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

sinozima

2019/02/04 09:44

bundle install のところで Your Gemfile has no gem server sources. If you need gems that are not already on your machine, add a line like this to your Gemfile: source 'https://rubygems.org' Could not find gem 'poppler (= 3.0.8) x64-mingw32' in any of the gem sources listed in your Gemfile. というエラーが出ます。 これも翻訳やググったのですがよくわからなかったです よろしくお願いしますm(_ _)m
Stan_Dma

2019/02/04 10:54

An official document is usually reliable when you do not understand about things. https://github.com/Belval/pdf2image . This shows that poppler will have to be installed. It's not a gem but a package software.
Stan_Dma

2019/02/04 11:15 編集

Im not sure more than above. Sorry. The error messages give a lot of information and it shows that your Gemfile would be incorrect. But I am afraid you should not do another question on the first question.
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問