Python erroring

0 votes

The below code throws me an error. which was working fine earlier.Not sure what happened now.Any help?

import win32com.client as win32

excel = win32.gencache.EnsureDispatch('Excel.Application')

wb=excel.Workbooks.Open('C:\Technical\AutomationScripts\Model_Variable_Path.xlsx')

excel.Visible = True


Trace Error 
File "C:\Technical\AutomationScripts\Testscript.py", line 2, in <module>
excel = win32.gencache.EnsureDispatch('Excel.Application')

File "C:\Program Files\Python39\lib\site-packages\win32com\client\gencache.py", line 625, in EnsureDispatch

mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], bForDemand=bForDemand)

AttributeError: module 'win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9' has no attribute 'MinorVersion'
Feb 10, 2023 in Others by Kithuzzz
• 38,000 points
898 views

1 answer to this question.

0 votes

Amend the spreadsheet file path from:

'C:\Technical\AutomationScripts\Model_Variable_Path.xlsx'

 To

 r'C:\Technical\AutomationScripts\Model_Variable_Path.xlsx'
answered Feb 10, 2023 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
4 answers

Python vs C++

Well C is very old programming language ...READ MORE

answered Apr 3, 2019 in Others by MrBoot
• 1,230 points
2,443 views
0 votes
1 answer

How to convert data from txt files to Excel files using python

Hi , there are few steps to ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,690 points
14,024 views
0 votes
1 answer

Print chosen worksheets in excel files to pdf in python

In the simplest form: import win32com.client o = win32com.client.Dispatch("Excel.Application") o.Visible ...READ MORE

answered Sep 24, 2022 in Others by narikkadan
• 63,600 points
3,564 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
0 votes
1 answer

Reading/parsing Excel (xls) files with Python

I highly recommend xlrd for reading .xls files. But there are ...READ MORE

answered Sep 21, 2022 in Others by narikkadan
• 63,600 points
780 views
0 votes
1 answer

Openpyxl password protect excel file python

Workbooks can be secured against certain actions, ...READ MORE

answered Sep 24, 2022 in Others by narikkadan
• 63,600 points
8,236 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP