错误跟踪使用EXEC打开多个文件时(Files(Files,' rb')。read())
我正在使用以下代码一次运行多个.py文件。 这些文件都非常具体,很容易更改。因此,我更容易个性化它们,这样我就可以在需要时更改它们。
calculate=(
'indicator1.py',
'indicator2.py',
'indicator3.py',
'indicator4.py',
'indicator5.py',
'indicator6.py',
'indicator7.py')
for file in calculate:
exec(open(file,'rb').read())
当我遇到错误时出现问题。我无法立即知道哪个文件有问题。
如何添加一些从计算找到错误的代码行?如果可能的话,也在该特定文件的哪一行中。
太感谢了!
I'm using the following code to run multiple .py files at once.
The files are all very specific and prone to change very often. So it's easier for me to individualise them so I can change them whenever I need to.
calculate=(
'indicator1.py',
'indicator2.py',
'indicator3.py',
'indicator4.py',
'indicator5.py',
'indicator6.py',
'indicator7.py')
for file in calculate:
exec(open(file,'rb').read())
The problem arises when I get an error. I have no way to immediately know which file has the problem.
How can I add some lines of code that return the specific file from calculate where the error was found? If possible, also in which line of that specific file.
Thank you so much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论