在try / python除外之后停止运行程序(Stop program from running after try / except python)
我做了一个程序,它从treeview中获取值,并在按下按钮时计算一些东西。 我把try / except语句放在那个函数里面。
def SumAll(): try: #do something (calculate) except ValueError: Error=messagebox.showinfo("Enter proper values") pass
问题是,当
messagebox.showinfo
出现时,程序会继续运行,并且会给出ValueError
。 我该如何解决这个问题,以及如何将多个错误异常(IndexError
等)?I made a program that takes values from treeview and calculate something when button is pressed. I put try / except statement inside that function.
def SumAll(): try: #do something (calculate) except ValueError: Error=messagebox.showinfo("Enter proper values") pass
The problem is, program keeps running when
messagebox.showinfo
appears, and it gives theValueError
. How can I fix that, and how can I put more than one error exception (IndexError
, etc)?
原文:https://stackoverflow.com/questions/49953598
满意答案
由于您希望通过电子邮件发送HTML表格,因此您只需创建一个HTML表格,并在每次出错时添加一些行。 然后将其包含在您的电子邮件内容中并发送邮件。
$users = mysqli_query($con, "SELECT * FROM table"); // Table header $htmlError = '<table><tr><th>ID</th><th>Column 1</th><th>Column 2</th></tr>'; while($row = mysqli_fetch_array($users)) { if ($row['column1'] != $row['column2']) { // Add new row to table $htmlError .= '<tr><td>'.$row['id'].'</td><td>'.$row['column1'].'</td><td>'.$row['column2'].'</td></tr>'; } } // End table $htmlError .= '</table>'; // Send mail ...
As you want to send an HTML table by email, you just have to create an HTML table and add some lines each time you have an error. Then include it into your email's content and send the mail.
$users = mysqli_query($con, "SELECT * FROM table"); // Table header $htmlError = '<table><tr><th>ID</th><th>Column 1</th><th>Column 2</th></tr>'; while($row = mysqli_fetch_array($users)) { if ($row['column1'] != $row['column2']) { // Add new row to table $htmlError .= '<tr><td>'.$row['id'].'</td><td>'.$row['column1'].'</td><td>'.$row['column2'].'</td></tr>'; } } // End table $htmlError .= '</table>'; // Send mail ...
相关问答
更多从基于android发送的电子邮件地址的服务器获取具有特定记录的列表视图(get list view with specific records from server based on email address sent from android)
使用jquery获取单个记录(get single records using jquery)
保存记录后发送电子邮件 - rails(Send an email once record is saved - rails)
在rails中以逗号分隔的电子邮件列表创建多个记录(create multiple records from comma separated email list in rails)
PHP在电子邮件中发送数组记录(PHP Sending array records in email)
从while循环获取一些记录到数组,然后通过电子邮件发送这些记录(Get some records from a while loop to an array, then send these records in an email)
如何确保salesforce中的工作流程没有触发电子邮件模板中没有记录/(How to make sure workflow in salesforce does not fire of there are no records in the email template/)
MS Access:将验证字段添加到已通过电子邮件发送的记录中?(MS Access: Adding a verification field to records that have been emailed?)
使用宏通过电子邮件发送报告,并在记录之间使用网格边框(using macro to send reports via email with gridline borders between records)
循环记录(Loop with records)
相关文章
更多Running Solr with Maven
《编程之道 Java》(Program JAVA)[ISO]
HDFS patch前后Ganglia看到running processes变化的分析
Another MySQL daemon already running with the same unix socket.
Python 写的Hadoop小程序
Mod_python: The Long Story
探索 Python,第 1 部分: Python 的内置数值类型
python2和python3的区别
Python的文件类型
python的下载与安装
最新问答
更多sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)
如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)
AESGCM解密失败的MAC(AESGCM decryption failing with MAC)
Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)
湖北京山哪里有修平板计算机的
SimplePie问题(SimplePie Problem)
在不同的任务中,我们可以同时使用多少“上下文”?(How many 'context' we can use at a time simultaneously in different tasks?)
HTML / Javascript:从子目录启用文件夹访问(HTML/Javascript: Enabling folder access from a subdirectory)
为什么我会收到链接错误?(Why do I get a linker error?)
如何正确定义析构函数(How to properly define destructor)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!