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,010 points
574 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,420 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,190 points
1,979 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,670 points
13,393 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,420 points
2,792 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,072 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,420 points
523 views
0 votes
1 answer

Openpyxl password protect excel file python

Please refer to the documentation here. Workbooks can be ...READ MORE

answered Sep 24, 2022 in Others by narikkadan
• 63,420 points
6,815 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