我有一些代码,其中我使用importlib.import_module()导入python文件,但是却遇到了一些奇怪的属性错误,当我运行相同的python脚本时(几天不做任何更改),这几天就没有了。错误如下:AttributeError: module 'win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9' has no attribute 'MinorVersion'
此外,完整的追溯:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\hp\Anaconda3\lib\tkinter\__init__.py", line 1705, in __call__
File "C:/Fourth Term @ Dal/Project/Collaboration/Sensitivity analysis/GUI/template5.py", line 88, in go_to_template6
importlib.import_module(Model_Variant)
File "C:\Users\hp\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Fourth Term @ Dal\Project\Collaboration\Sensitivity analysis\GUI\Day1Yes Base Model.py", line 219, in <module>
excel = win32.gencache.EnsureDispatch('Excel.Application')
File "C:\Users\hp\Anaconda3\lib\site-packages\win32com\client\gencache.py", line 534, in EnsureDispatch
File "C:\Users\hp\Anaconda3\lib\site-packages\win32com\client\gencache.py", line 447, in EnsureModule
AttributeError: module 'win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9' has no attribute 'MinorVersion'