简体   繁体   中英

In Python3, the openpyxl code is failing to compile

I'm trying to run code that worked last week, but when I try today, I get this error:

Traceback (most recent call last):
  File "/Users/voyager2/mu_code/IEDBWork/PMID32502341/32502341DSTMaker.py", line 6, in <module>
    import openpyxl, pprint, sys
  File "/Applications/mu-editor.app/Contents/Resources/app_packages/openpyxl/__init__.py", line 6, in <module>
    from openpyxl.workbook import Workbook
  File "/Applications/mu-editor.app/Contents/Resources/app_packages/openpyxl/workbook/__init__.py", line 4, in <module>
    from .workbook import Workbook
  File "/Applications/mu-editor.app/Contents/Resources/app_packages/openpyxl/workbook/workbook.py", line 7, in <module>
    from openpyxl.worksheet.worksheet import Worksheet
  File "/Applications/mu-editor.app/Contents/Resources/app_packages/openpyxl/worksheet/worksheet.py", line 24, in <module>
    from openpyxl.cell import Cell, MergedCell
  File "/Applications/mu-editor.app/Contents/Resources/app_packages/openpyxl/cell/__init__.py", line 3, in <module>
    from .cell import Cell, WriteOnlyCell, MergedCell
  File "/Applications/mu-editor.app/Contents/Resources/app_packages/openpyxl/cell/cell.py", line 1
    s stuff# Copyright (c) 2010-2019 openpyxl
          ^
SyntaxError: invalid syntax

It seems like there's a problem in the openpyxl. That code popped up when I was debugging, and I fear I may have accidentally typed something in it. But now I can't figure out how to open up the openpyxl code to check.

Check that your file is not running in Microsoft Excel or any other excel editor. Or I think reinstall openpyxl may help you pip uninstall openpyxl and then pip install openpyxl

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