소스 검색

fixed file not closed

oloturia 3 년 전
부모
커밋
9ebd2a8748
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      telegram_main.py

+ 3 - 1
telegram_main.py

@@ -12,7 +12,9 @@ def newStrip(bot, update, args):
 	status = createStrip(config)
 	if status == 0:
 		try:
-			bot.send_photo(chat_id=update.message.chat_id,photo=open(config["saveLocation"]+config["filename"],"rb"))
+			strip_file=open(config["saveLocation"]+config["filename"],"rb")
+			bot.send_photo(chat_id=update.message.chat_id,photo=strip_file)
+			strip_file.close()
 		except Exception as err:
 			print(err)
 	else: