当我将pywhkit库放在里面时,烧瓶应用程序不会编译
我在烧瓶中有一个应用程序,并试图在该应用程序中插入一个代码,以自动将消息发送到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")
两个代码都可以完美地工作,但是当我将两个代码放在一起时,代码不会编译。
我做了一些测试:
我尝试只是
在烧瓶应用程序中将pywhkit导入为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)
为什么在将 pywhwhkit 库放入烧瓶应用程序中时,我不能编译代码?
I have an application in flask and I tried to insert within that application a code to automatically send messages to whatssap.
- Code:
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")
Both codes are working perfectly, but when I put the two codes together the code doesn't compile.
I did some tests:
I tried to just
import pywhatkit as pwk
in the flask application;I tried to use the code in another python file and import;
I tried to put both codes together in same python file.
In all situations the code does not compile, when I debug the code for test 1, I get the following error:
Exception has occurred: SystemExit 3
File "C:\Users\diego\codes\Working\modify.py", line 96, in <module>
app.run(debug=True)
Why can't I compile my code when I put the pywhatkit library inside the flask application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于所有遇到类似问题的人,我能够通过安装 pywhkit 版本5.0来解决它。
For all of you who have a similar problem, I was able to solve it by installing pywhatkit version 5.0.