-
Notifications
You must be signed in to change notification settings - Fork 0
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
Volumeマウントして、そこでデータを一時的に保持します。 #16
Conversation
notify/notify.py
Outdated
with open(CONTENT_PATH) as fr: | ||
file_content = fr.read() | ||
|
||
if file_content != messege: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if message
の中に、if file_content != messege:
があるのが気持ち悪い。これ一個にできんじゃないの
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一個にしました
2bb9be0
notify/notify.py
Outdated
try: | ||
with open(CONTENT_PATH, mode='x') as f: | ||
f.write('') | ||
except FileExistsError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@solaWat
try , exceptはどういうお気持ちで書いている?
ファイルがない時に88行目でこけないように書いているんかな
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
りかい
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この記事からもらってきました
https://note.nkmk.me/python-file-io-open-with/
むしろファイルがある時にキャッチしてる。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
僕も先程同じサイトを見ました
notify/notify.py
Outdated
if messege and messege != file_content: | ||
with open(CONTENT_PATH, mode='w') as fw: | ||
fw.write(messege) | ||
PythonNotify(f"@{user}" + messege + day.upper(), TOKEN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if message の message をなくして 予約なかったら 現在予約なしなどと PythonNotify関数でつぶやいてもらうこと出来る?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
別のissueにしよう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そうしよう
notify/notify.py
Outdated
try: | ||
with open(CONTENT_PATH, mode='x') as f: | ||
f.write('') | ||
file_content = '' | ||
except FileExistsError: | ||
pass | ||
with open(CONTENT_PATH) as fr: | ||
file_content = fr.read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
例外キャッチ使わずに
if os.path.isfile(CONTENT_PATH):
with open(CONTENT_PATH) as fr:
file_content = fr.read()
else:
file_content = ""
としていみるのもいいかも
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そっちもいいね。
import os
を追加しなきゃいけなかったから、やめといた。
LINEの通知がウザすぎたので、その場しのぎですが、差分比較します。
Issue : #1