简体   繁体   中英

OSError: [WinError 193] %1 is not a valid Win32 application in python

I am trying to run this code. I have added the transactions.xlsx to the project. I am getting this error

OSError: [WinError 193] %1 is not a valid Win32 application.

I've checked some older posts and it is mentioned that this might have to do with my PyCharm being 64bits. I did install openpyxl and it is in my external libraries. Any hints will be greatly appreciated. I am really new to Python.

 import openpyxl as xlm
 wb = xlm.load_workbook('transactions.xlsx')
 sheet = wb['Sheet1']
 cell = sheet['a1']
 cell = sheet.cell(1, 1)
 print(cell.value)

I am not sure what was causing the issue. What I did was uninstall PyCharm and reinstalled it. Issue was solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM