【发布时间】:2023-02-07 02:04:07
【问题描述】:
我在烧瓶中有一个应用程序,我试图在该应用程序中插入一个代码以自动将消息发送到 whatssap。
- 代码:
import pywhatkit as pwk
import time
def whats():
tim = time.localtime()
hour = int(time.strftime("%H", tim))
min = int(time.strftime("%M", tim))
if min==59:
min = 0
else:
min += 1
# using Exception Handling to avoid unexpected errors
try:
# sending message in Whatsapp in India so using Indian dial code (+91)
pwk.sendwhatmsg("+5587988758805", "Trabalhador sem EPI!", hour, min)
print("Message Sent!") #Prints success message in console
# error message
except:
print("Error in sending the message")
这两个代码都运行良好,但是当我将这两个代码放在一起时,代码无法编译。
我做了一些测试:
-
我试图在烧瓶应用程序中只使用
import pywhatkit as pwk; -
我试图在另一个 python 文件中使用代码并导入;
-
我试图将这两个代码放在同一个 python 文件中。
在所有情况下,代码都无法编译,当我调试测试 1 的代码时,出现以下错误:
Exception has occurred: SystemExit 3 File "C:\Users\diego\codes\Working\modify.py", line 96, in <module> app.run(debug=True)为什么在我放置时无法编译我的代码pywhatkitFlask 应用程序中的库?
【问题讨论】:
-
对于所有遇到类似问题的人,我能够通过安装来解决pywhatkit5.0版
标签: python flask whatsapp messaging